L EARNING T EMPORAL R ULES FROM N OISY T IMESERIES D ATA
Anonymous authors
Paper under double-blind review
A BSTRACT
Events across a timeline are a common data representation, seen in different temporal modalities.
Individual atomic events can occur in a certain temporal ordering to compose higher level composite events.
Examples of a composite event are a patient’s medical symptom or a baseball player hitting a home run, caused distinct temporal orderings of patient vitals and player movements respectively.
Such salient composite events are provided as labels in temporal datasets and most works optimize models to predict these composite event labels directly.
We focus on uncovering the underlying atomic events and their relations that lead to the composite events within a noisy temporal data setting.
We propose Neural
Temporal Logic Programming (Neural TLP) which first learns implicit temporal relations between atomic events and then lifts logic rules for composite events, given only the composite events labels for supervision.
This is done through efficiently searching through the combinatorial space of all temporal logic rules in an end-to-end differentiable manner.
We evaluate our method on video and healthcare datasets where it outperforms the baseline methods for rule discovery.
I NTRODUCTION
Complex time series data is present across many data modalities such as sensors, records, audio, and video data.
Typically there are composite events of interest in these time series which are composed of other atomic events in a certain order (Liu et al., 1999; Chakravarthy et al., 1994; Hinze, 2003).
An example is a health symptom that can be observed in a doctor’s report.
Atomic events, such as patient vitals and medications, and their temporal relations dictate an underlying causal rule leading to the composite event symptom.
These rules may be unknown but useful to recover (Kova ˇ cevi ´ c et al., 2013; Guillame-Bert et al., 2017).
Recent methods leverage the advances in highly parameterized deep architectures to learn latent representations of atomic event data (Pham et al., 2017; Chen et al., 2018; Choi et al., 2019), with the increasing availability of large temporal datasets.
Methods, such as LSTM (Hochreiter & Schmidhuber, 1997) or Transformer (Vaswani et al., 2017) based architectures, provide stateof-the-art performance in terms of composite event inference.
However, it is uncertain whether the latent representations learn the underlying causal sequence of events or overfit spurious signals in the training data.
Having representations faithful to causal mechanisms is advantageous for interpretability, out-of-distribution generalization, and adapting to smaller data sets.
Therefore it is important to leverage parametric models that can handle data noise while providing a mechanism to extract explicit temporal rules (Carletti et al., 2019).
Extracting explicit logic rules has been studied through Inductive Logic Programming (ILP) methods (Muggleton, 1991; Muggleton & De Raedt, 1994) and have been leveraged in parametric fashions as well (Yang et al., 2017; Evans & Grefenstette, 2018; Rocktäschel & Riedel, 2017).
ILP starts with set of background knowledge, consisting of grounded atoms (i.e. facts which do not contain variables) such as location ( Braves, Atlanta ) , where the predicate location determines the relationship between the items Braves and Atlanta .
There are set of labels from which rules should be learned.
The task is to construct a set of rules, when executed over the background knowledge, entail the provided labels.
Given the label InLeague
( Braves, NL East ) and the background knowledge (Figure 1 ILP Input) as input, a candidate rule is InLeague ( Team, League ) :
=
Location ( Team, City ) ∧
[Figure]
Division ( City, League ) .
Here InLeague ( Team, League ) is the head of the rule consisting of an atom with variables Team, League as items.
The body consists of two atoms and when these atoms exist on the background knowledge the rule is evaluated as true.
We apply ILP over real world temporal data, however learning such rules poses three key challenges.
Temporal Background Knowledge First, ILP methods operate over an existing grounded background knowledge.
The temporal case does not have this knowledge when operating over raw time series.
For example in a baseball video, grounded atomic events pitch or swing , or grounded predicates such as before ( pitch, swing ) are not explicitly provided.
By nature, the video would be labeled with a higher level composite event description, such as "Player A
’s home run " instead of individual atomic events and their corresponding temporal predicates.
Such atoms can be extracted using a model in a probabilistic fashion at each time point, and a temporal ILP method should handle this uncertainty.
The temporal predicates between these probabilistic atomic events can be applied in a rule-based manner (ex. t 1 < t 2 → before ), but due to the noisy nature of extracted atomic events, the predicate predictions should be robust to consistent noise in the atomic event data.
Atomic Event Relevance Second, ILP works learn consistent rules that satisfy a path in the background knowledge given the terms in the labels, such as InLeague ( Braves, NL East ) .
The labels are nullary predicates in the temporal case, so the relevant source and target atomic events and predicates to use for rule induction are unknown.
In our example, we know from the video we have a label strike , but are not told when it occurred or what other events, such as pitch , swing , and miss are needed to compose a rule for strike .
Without a prior on which atomic events to search from, we must consider all pairwise temporal relations between atomic events in the input.
This leads to a combinatorial search of all pairwise events for each predicate in the temporal rule body.
Multi-Event Labels Third, ILP domains work on disjoint labels, while in time series, multiple composite events could occur in each input.
In our baseball video, such as a highlight reel, composite event labels strike , steal and their corresponding atomic events can co-occur in a single video.
This further extends the search space of atomic events we consider for each composite event rule.
We illustrate these differences in Figure 1 and further discuss these challenges regarding search complexity in Appendix A. To address these challenges, Neural TLP operates on two key steps.
Parameter Learning First Neural TLP inputs probabilistic atomic events and learns parameters to infer temporal predicates between atomic events.
We represent the atomic event data in an intervalbased representation to efficiently predict all pairwise predicates between atomic events.
The inferred predicates are then projected to predict the composite event labels.
Structure Learning When the predicate parameters are learned, Neural TLP learns a sparse vector to select the correct rule over the combinatorial space of possible rules.
To prune the search space, we use the learned projected weights to select candidate grounded predicates per composite event.
We evaluate our method on a synthetic video dataset to empirically test our temporal rule induction performance.
Additionally, we apply our framework to provide relevant rules in the healthcare domain, which were verified by doctors.
P ROBLEM F ORMULATION
We define the complete set of atomic events X = { x 1 , x 2 , . . .
, x |X| } along a timeline T .
These atomic events can be existing features in time series data or user defined features of interest.
A temporal logic rule r ( X r , T r ) can be defined as using a subset of N ≤ |X| atomic events X r = { x u } Nu =1 ⊆ X , and their associated time intervals T r = { t u } Nu =1 ⊆ T .
The time intervals consists of start and end times t u
= [ t u start , t u end ] .
These intervals indicate durational events and we can also initialize instantaneous events occurring at one time point where t u start
= t u end .
A rule is evaluated as true if the corresponding atomic events x u are present and are in correct ordering with respect to the intervals t v of other events x v :
[Equation]
The temporal predicates p i ∈ { before, during, after } =
P represent a simplified subset of Allen’s Temporal Algebra (Allen, 1983).
We simplify the notation of the rules as a conjunction of temporal predicates between observed events, where the event time intervals are implicit:
[Equation]
For example, the grounded predicate before ( pitch [2 , 2 . 7] , swing [3 , 3 . 5] ) would evaluate to true.
These underlying causal rules r induce the composite event labels r
→ y r seen in the data.
Multiple composite events of interest can co-occur during the same time series sample T which we denote as y =
{ y r } |R| ∈ { 0 , 1 } |R| .
Any y r = 1 indicates the latent rule r occurred over T resulting in label y r .
While T contains precise atomic event interval information, the observed time series ˜ T consists of a sequence of probabilistic atomic events from times [1 , T ] .
Potentially k different objects ˜ T i compose the final time series data ˜ T
= (cid:83) ki =1 ˜ T i .
Examples of objects can be multiple concurrent sensor data, or tracking multiple people moving within a video.
Then the input ˜ T is formulated as
M T ∈ [0 , 1] k ×|X|× T across object, atomic event, and probability dimensions respectively.
The temporal ILP task is to recover all underlying rules R given m samples of inputs and labels { ( M T i , y i ) } mi =1 .
In Neural TLP this involves learning parameters for the predicates between atomic events and then learning the combination of grounded predicates that induce each r ∈ R .
N EURAL T EMPORAL L OGIC P ROGRAMMING
Neural TLP operates in two stages.
The parameter learning stage learns how to compress the temporal data and learns parameterized temporal predicates.
Once these parameters are learned, the structure [Figure] [Figure] [Figure]
predicateprediction dense inference sparse selection [Figure] 1) parameter learning [Figure]
2) structure learning
[Figure]
rule
[Figure]
learning stage learns which conjunctive combination of pairwise atomic event predicates is associated with each composite event label.
This conjunction composes the rule r for label y r and is jointly computed for all R .
An overview of the framework is presented in Figure 2.
3. P ARAMETER L EARNING S TAGE
Temporal Compression Starting from the raw probabilistic atomic event data, we first compress the timeline through convolution.
This 1D convolution over the temporal dimension compresses and smooths the timeline to mitigate noise from spurious events.
Here the convolution kernel K |X|× l of length l is learned per atomic event.
We also parameterize α as an extra degree of freedom to scale these convolved scores, which is useful when computing the intermediate predicates downstream.
[Equation]
The time information is incorporated by multiplying the time dimension M D into compressed events:
M A ∈ R k ×|X|× t = M C ⊙ M D .
Here M D has the same dimensions as M C , but the temporal dimension is enumerated from [1 , t ] , where M D : , : ,l = l .
This can be thought as a positional encoding.
For example if we look at the sample compressed scores for a single object i and atomic event j M C i,j, 6:10 =
03] and M D i,j, 6:10 = [6 , 7 , 8 , 9 , 10] then M A
i,j, 6:10 = [ . 06 , .
Intuitively we can see that from M A i,j, 6:10 that (1) atomic event j occurs when the scores are high at 5.6 and 6.3 and that (2) score 6.3 occurs after score 5.6 due to the multiplied time index.
This temporal representation provides a path to compute precise time intervals of atomic event occurrences and define predicates to compare atomic event intervals.
Predicate Modeling From the compressed timelines, we determine the temporal predicates between atomic events.
These relations are computed in a pairwise manner for all atomic events
∀ x u , x v ∈ X occurring in object i through a small network which we call Temporal Predicate Network (TPN).
For notation sake here, we represent the atomic event
u ’s timeline for object i as t iu = M A
i,u, : ∈ R t and correspondingly for atomic event v .
We denote TPN as g θ ( t iu , t iv ) , which takes pairwise atomic event timelines and predicts a temporal predicate p ∈ P to indicate the relationship between the atomic events.
Methods such as Temporal Relation Networks (Zhou et al., 2018) learn these predicates between video events by sampling frames throughout the video.
The timelines can be long in our setting, and events can occur sparsely, making sampling timelines expensive and noisy.
To efficiently compute these relations, we would like to recover each event’s underlying start and end time intervals.
From intervals, we can encode strong inductive biases to predict the predicates.
We are working with continuous time series scores in t iu , t iv , so the intervals have to be extracted as the first step in TPN.
t t t t max tt max t max min      e v en t p r ob time
[Equation]
To get the end of the event interval we simply compute u end
=
max( t iu ) since we multiplied the event scores with the time index earlier.
This interval computation from the input time series is visualized in Figure 3.
This is computed similarly for the other pairwise event v : [ v start , v end ] .
Given the start and end times for the event pairs u, v , the un-normalized predicate scores are computed as: before(u, v) = v start − u end (5) after(u, v) = u start − v end (6) during(u, v) = min( { v end − u start , u end − v
[Equation]
Although we use 3 predicates in our model, similar scores can be developed for more fine grained predicates.
Then the values are aggregated as p =
[ before(u, v) ; during(u, v) ;
after(u, v) ] to compute normalized predictions as p = softmax ( p − βγ ) .
Here β and γ and scale and shift parameters learned from data.
Our predicates scores assume that intervals for both u and v occur, so if either event doesn’t occur we suppress all predicate predictions:
[Equation]
Since we leverage a simple interval representation to compare atomic event objects, we can scale comparing atomic events within the object and between the other k − 1 objects: x u ∈ X , x v ∈ ( X × k ) .
This second-order interaction information is useful if we want to know if, for example, two events occurred simultaneously within different objects.
For a single object i , these relations are computed for all pairwise predicates through TPN in M P ∈ R |X|× ( |X|× k ) ×|P|
= R k ×|X|×|X|×|P| .
Aggregating over all objects k , we get M Q =
[ M P 1 ; . . .
; M P k ] ∈ R k 2 ×|X|×|X|×|P| .
We marginalize over the object dimension to get our final pairwise relation matrix M R =
(cid:80)
i M Q i, : , : , : ∈ R |X|×|X|×|P| .
Composite Event Prediction
The final inference step from the pairwise relational predicates to the composite events labels is carried out by f ϕ .
This is a linear projection function f ϕ ( M R ) :
= σ ( dropout ( vec ( M R )) W ) used to infer the composite event labels ˆy .
[Figure]
3. S TRUCTURE L EARNING S TAGE
Predicate Selection To induce the logic rules R , one method is to look at our projection weights
W .
Here we can select the highest weighted entries corresponding to grounded predicates for each label y r .
One can use a conjunction of these predicates to construct the rule r for y r .
However, in most cases, the number of predicates needed to compose a rule is unknown apriori.
Additionally, setting thresholds for information gain splits is heuristic-based and error-prone, especially when one cannot observe the underlying rules for verification.
Combinatorial Inference Instead of setting thresholds, we directly optimize over the space of combinatorial rules to infer our composite event label y r .
Starting from the predicted grounded predicates vec ( M R ) ∈
R d where d = |X| · |X| · |P| we initialize a combinatorial matrix up to a max rule body length n :
[Equation]
Here for each unique column in C i will have indicators for the i chosen predicates, corresponding to one possible combination.
Since (cid:0) di (cid:1) can be quite large, we sample the top c < d predicate weights in
W : ,y r .
Then combinations can be initialized over those c predicate indices
C i ∈ R
d × ( ci ) .
Selecting the most relevant combination across all combinations is done through an attention vector a = softmax ( s ) where s ∈ R (cid:80) ni
=1 ( ci ) .
It is used to weight the combinations c ∈ R d = (cid:80) j a j C : ,j and the label can be inferred by ˆ y r =
c ⊤ vec ( M R ) , thus ˆy =
[ ˆ y r for each r ∈ R ] .
Note that we maintain separate attention parameters s and unique C for each label y r ∈ y , since each rule relies on different predicates.
Rule Induction To extract the rule we simply choose the column in C j where j = arg max s corresponds to the maximum attention value.
Each indicator value i in C ij correspond to a grounded temporal predicate p i ∈ P between two events x iu , x iv ∈ X , which are used to construct a rule:
[Equation]
[Figure]
This is followed for every composite event label y r to provide our final set of rules R .
This full process is illustrated in Figure 4.
3. O PTIMIZATION
Now that we have defined our inference procedure to obtain ˆy from both parameter and structure learning stages, we describe the overall training.
To train over the data { ( M T , y ) } mi =1 , each stage minimizes the standard cross entropy loss between y and ˆy , denoted as L ent , using the Adam optimizer (Kingma & Ba, 2014) (details in Appendix B).
The parameter learning stage is trained first over the convolution α, K , predicate β, γ , and projection
W parameters.
For W we add L 1 regularization (denoted as L 1 ) and project the weights between [0 , 1] to mimic logic weights (Chorowski & Zurada, 2014; Riegel et al., 2020).
We also constrain the convolution scalar α between [0 , 1] .
This gives us our final stage objective to optimize L =
L ent + λ 1 L 1 where λ 1 = 0 .
The structure learning stage is trained next to optimize L ent over all attention vectors s corresponding to each label y r , while freezing all other parameters.
Each stage is trained in an end-to-end differential manner, after which the temporal logic rules R are induced.
E XPERIMENTS 4. CATER
We explore composite event prediction over complex videos in the CATER dataset (Girdhar &
Ramanan, 2019).
CATER consists of videos containing objects moving around a scene.
The object movements correspond to |X| =
14 distinct atomic events.
Every combination of predicates between atomic events yields a rule of length n = 1 , and when this combination occurs in the video, it induces that corresponding label.
There are |R| = 301 rules to recover and the average number of labels per video ¯ y = 1 m (cid:80) mi =1 (cid:80) y r ∈
y
i
y r
= 53 out of 301.
In previous works on the CATER, the main metric is mean average precision (mAP) over the labels.
Due to its synthetic nature, we know the ground truth rules used to induce the labels, so we can also empirically evaluate how well our models can recover these rules in its top k rule predictions (Hits@k).
The overall task for CATER is illustrated in Figure 5.
Baselines We test Neural TLP against two baselines.
For the first baseline, we input our M T matrix into attention-based LSTM (Hochreiter & Schmidhuber, 1997) and predict the composite events.
Since we are dealing with only single predicate rules, we synthesize each rule combination within M T and assign it to the highest weighted label.
We define the second baseline as Temporal MAP, which uses the same Neural TLP model.
We freeze the parameters and the weight W is a count of co-occurring grounded relational predicates and labels.
This setup is akin to processing atomic event relations deterministically and computing W through
MLE.
The rule extraction follows the same methods as Neural TLP, and additional baseline details are laid out in Appendix C.
[Table]
[Table] [Table]
We experiment where the atomic events are obtained from a noisy environment or inferred from a process upstream, such as our baseball video.
To infer the atomic events, we detect the objects through a Faster R-CNN (Ren et al., 2015) and use its cropped image feature and optical flow to predict the shape and movement.
These atomic events are predicted and cached prior to inputting them in our models.
From the results in Table 1 we see that our more structured method is the most optimal for extracting rules.
MAP provides a coarse representation of the labels and enumerated rules with no parameters.
It can express these rules better than LSTMs but lags behind our method.
As the number of free parameters increases, the LSTM models are more likely to pick up spurious signals in the data that are useful from a cross-entropy optimization perspective but deviate from the underlying generative rule representation (Hits).
This can be seen with highly parameterized LSTM models and video models: I3D (Carreira & Zisserman, 2017), TSN (Wang et al., 2016), and TSM (Lin et al., 2019), leading to larger gains in mAP in Table 2.
Even for mAP, we show that our underlying rule representation is useful when generalizing out of distribution. Here we fix our trained LSTM and Neural TLP models and test on out of distribution data where the frequency of labels is changed in Table 3. We show that Neural TLP performance degrades gracefully as it is exposed to out of distribution data.
We further ablate our Neural TLP model architecture and hyperparameters in D.2.
We show the effectiveness of our method on recovering longer dynamic length rules over Temporal MAP in
Appendix D.3.
Now that we tested Neural TLP on synthetic tasks to empirically verify the rule accuracy, we explore its capabilities on real-world healthcare data.
4. H EALTHCARE D ATA
We test the rules recovered from Neural TLP on patient data in MIMIC-III (Johnson et al., 2016).
We specifically look at 2023 patients admitted for sepsis (severe infection) and recover the rules corresponding to stable vitals.
This is done through predicting urine output as the composite event, an auxiliary variable indicative of the state of the patient’s fluids and circulatory system (Komorowski et al., 2018).
There are |X| =
82 different atomic events, composed of drugs administered and patient vitals.
The vitals are made into boolean events through logic rules provided by doctors, which
[Table] [Table]
indicate the vital severity: low, normal, or high. The model’s task is to learn rules corresponding to normal urine outflow. We present the top rules from Neural TLP and MAP to doctors for verification.
From the results in Table 4, we see this is a difficult problem due to a large number of atomic events and small sample size.
However, it indicates that the learning done by Neural TLP is useful to learn and to rank important predicates before rule training.
Temporal MAP fails at this task with the increased number of atomic events and longer timelines, which led to many grounded predicates (2-3k) per sample.
Therefore the W weights are very coarse and filled with common relations.
In addition to relevant rules, Neural TLP maintains good inference performance (Table 5), which is also an important metric for this domain.
From the doctors’ feedback, we also present the rules learned in Appendix E, but emphasize that these are observed facts .
This means that the rules are partially explained by a subset of predicates and not considered treatment rules, as the rules didn’t contain any drugs administered.
The doctors did confirm that we captured important explanatory variables in our proposed rules, so we are optimistic about using our framework for feature selection in complex temporal environments.
R ELATED W ORK
Structured Temporal Prediction To optimize over the composite events given observed atomic events, Hidden Markov Models (HMMs) are commonly used to model the latent rules that emit consistent atomic events to induce the composite events.
Variants of HMMs have been developed to handle symbolic atomic events (Mutschler & Philippsen, 2012; Kersting et al., 2006; Liu et al., 2017) to more perception-based events, such as videos (Tang et al., 2012).
Deep models have shown to incorporate temporal logic constraints within their outputs by leveraging Transformers architectures (Finkbeiner et al., 2020), knowledge distillation (Ma et al., 2020), and by representing temporal logic as a differentiable loss (Innes & Ramamoorthy, 2020).
However, interpreting latent representations of deep models in order to extract explicit rules is still being researched (Arras et al., 2019; Chefer et al., 2021; Lal et al., 2021).
Rule Representations and Inference To explicitly induce rules over data, a space temporal logic rules can be searched to determine appropriate rules.
Temporal rules are induced using satisfiability (SAT) based methods (Neider & Gavran, 2018; Camacho & McIlraith, 2019) given strong priors to the rule structure and limited data noise.
In the presence of noise, softening logic rules using
Markov Logic Networks (Richardson & Domingos, 2006; Song et al., 2013) or probabilistic logic (ProbLog) (De Raedt et al., 2007; Kimmig et al., 2011) perform approximate inference well, but are intractable for rule training.
Recently Yan & Julius (2021) proposed a network to learn sparse weights for temporal rules given a fixed rule format.
Inductive Logic Programming Extracting expressive rules is explored through Inductive Logic
Programming (ILP) methods (Muggleton, 1991; Muggleton & De Raedt, 1994)
and within Statistical
Relational Learning literature (Koller et al., 2007; De Raedt & Kersting, 2010).
Given fixed background knowledge, parameterized models softly select the relevant facts used to derive the labels and therefore lift logic rules (Yang et al., 2017; Evans & Grefenstette, 2018).
Atoms can also be represented as latent vectors to provide probabilistic facts for increased generalizability (Rocktäschel & Riedel, 2017).
Dong et al.
(2019) present a more neural architecture to represent first-order logic and scale to larger rule search spaces.
C ONCLUSION
Composite event extraction is a common task across many temporal domains.
It is important to understand the underlying atomic events and their predicates that induce the composite event.
We propose Neural TLP that learns these composite event rules even when provided noisy temporal data.
It first learns parameters for atomic event timeline compression and pairwise predicate prediction.
Then once grounded predicates are reliably inferred, the structure learning stage learns over the space of combinatorial predicates to induce the final rules.
We verified our method on synthetic video tasks and explored rule recovery in a real-world healthcare dataset.
Ethics Statement Neural TLP, like any data-driven model, has potential societal impacts that could include extracting unfairly biased rules or relations.
In such cases, we envision using such a framework for knowledge discovery over end decision making.
We operate on hospital patient data, through MIMIC-III which has been de-identified to avoid leaking privileged patient information.
Reproducibility Statement We provide the entire model code for our framework in the supplementary materials.
The dataset for CATER is publicly available, and we have provided the processing code to generate our custom CATER data.
We are in the process of sharing the experimental code for the MIMIC-III experiments as well.
We further describe our optimization procedures (Appendix B), hyperparameters (Appendix D.2) and baseline model architectures (Appendix C) for clarity.
A T EMPORAL ILP C OMPARISON
Neural LP
In typical ILP problems, such as Neural LP (Yang et al., 2017), the rules are induced over a static knowledge base.
This involves learning the walks along the static graph G S =
( E S , R S ) .
Starting at entity node e x ∈ E S Neural LP learns the associated edge relations R S to traverse in order to reach the corresponding ending entity node e y .
Since between two entities there can be many arbitrary paths, given the data, the most likely path is found.
This is done by learning the attention α over relational predicates matrices M R k to traverse from v x to v y .
Here v x , v y are one hot embeddings of the start and entities respectively.
[Equation]
Then the objective is to maximize the score ˆv ⊤ y v y of selecting the correct end entity e y through paths selected by α kt .
The edges along this path compose the predicates of the rule between e x , e y .
Refer to the original paper for full details and implementation (Yang et al., 2017).
Knowledge Representation
In temporal rule learning one can also compose a graph between the entities (events) on the timeline.
However the structure of such a dynamic graph G D =
( E D , R D ) over time is different.
The dynamic graph typically contains fewer events |E D | < |E S | , and the graph is dense as every event has some temporal relation with respect to all other events.
The edge relations may not be provided in unified knowledge base, where the relations can vary per sample m : R D
= {R 1 D , R 2 D , . . .
, R m D } .
Furthermore these temporal relations between samples are rarely annotated with the relations of interest, while in static case, the relations R S are usually predetermined.
Rule Induction When learning rules in the temporal case, many rules don’t conform to the chain like rule structure.
This can be seen in the form f :=
after(a, b) ∧ before(c, d) where there is no path between the first predicate and the second (see the last rule in Table 9 as an example).
Without a path between two events to guide the rule construction, the rule can potentially involve any events and relations.
Formulating the problem in terms of a walk is challenging to evaluate if we consider all relations between the disjoint events and selecting the most likely rule:
[Equation]
Here, events between two pairs of predicates are disjoint if there does not exist a common event between the two predicates.
If not, we would have to sample all combinations of X, Y from each predicate respectively: (a, c) , (a, d) , (b, c) , (b, d) .
Instead of expensive marginalization, we aim to search for combinatorial combinations of grounded predicates in a differentiable fashion.
This search space for Temporal ILP grows faster with larger numbers of atomic events and relations.
Lemma.
In Temporal ILP, given the space of events E = |X| , predicates P = |P| , and a rule with n predicates, the search space for a rule r is generally O
(( PE 2 ) n ) .
If P consists of symmetric relations, such as before ( u, v ) = after ( v, u ) , and an equivalent relation during ( u, v ) = during ( v, u ) , we keep ⌊ P 2 ⌋ of the symmetric relations and the unique values in the equivalent relation.
Then the bound can be tightened to Θ(( ⌊ P 2 ⌋ E 2 + E ( E +1) ) n ) unique combinations of rules.
In ILP given the knowledge base, to construct a rule for predicates with a pair of entity variables
E 1 , E 2 and average node degree D , the search space is Θ( D n ) .
The corresponding temporal models and rule extraction methods has to reflect these differences.
We focus on structured time series tasks where we have to learn temporal predicate parameters in addition to the temporal logic formulas from the samples.
Our model Neural TLP learns these temporal relations between pairwise atomic events, with considerations of event noise as well as computational complexity.
Then given the inferred relations, the combinations of relations can be learned such that the correct composite event is inferred.
B O PTIMIZATION
We used the Adam (Kingma & Ba, 2014) optimizer with a learning rate of 0.001 for all our experiments and the default parameters described in their paper.
The batch size during relational training is set to 256.
Each experiment was run for 100 epochs to train the relation parameters and weights W .
For variable rule length search we tested longer epoch lengths, but didn’t see much improvement in the validation past the first epoch.
Therefore 1 epoch of tuning was done to optimize the combinatorial attention weights s while freezing all other relation parameters.
All experiments were conducted on a server with a Nvidia 2080TI
GPU with 11GB of VRAM.
We made sure all our model configurations could fit on a single GPU of this size.
The memory intensive component came from having different attention weights s and combinatorial matrices C for each rule r ∈ R learned.
This meant that we had to limit the number of predicates combinations we search over.
Here c is the number of most relevant predicates searched per rule and n is the max number of predicates, so the number of combinations for the max rule length is (cid:0) cn (cid:1) .
So for each variable rule length of 1,2,3,4 we chose c = 100 , 100 , 30 , 25 respectively.
Due to the larger memory requirements, we reduce the batch size during rule search to 64.
C B ASELINES C. LSTM
Since we are working with multi-hot labels, and co-occurring atomic events, it is difficult to parametrize existing HMM variants.
Therefore we test a more neural recurrent baseline, LSTM (Hochreiter & Schmidhuber, 1997), over the raw atomic event stream.
To account for object invariance, we marginalize over the timelines to produce the inputs ˜ M T =
(cid:80) k max (1 , M T k, : , : ) ∈ R |X|× T .
The compressed timelines and temporal indexing are done over ˜ M T to produce M A .
From M A ∈ R |X|× t we input x ∈ R |X| at each step t : x i , h i , c i =
LSTM ( x i − 1 , h
i − 1 , c i − 1 ) , where c is the cell state.
Then we perform classification over the labels through a linear layer using the last hidden state ˆ y =
Wh t + b .
We test both a large (L) and a small (S) version with hidden dimensions of | h | =and | h | = 160 respectively.
We also test an attention based variant where the attention value for each hidden state is computed using the hidden state as well as the input atomic events at that step.
This helps the model focus on time steps that are not empty over long frame sequences, and led to better convergence.
[Equation]
Here W 1 ∈ R ( | h | + | x | ) ×
d and b 1 ∈ R d project the concatenated data into attention dimension d , which was set to d = 32 for all our experiments.
To extract the rules, we first enumerate all possible composite events.
Then we synthesize each composite events as raw event timeline data.
Unlike the original training data where there are multiple atomic events occurring simultaneously, for each composite event we have two atomic events occurring unambiguously before , during , or after one another.
Then we pass the synthesized events into the model and take the argmax prediction as the corresponding rule label.
C. T EMPORAL MAP
While LSTMs optimize for label prediction, a baseline to test rule induction is to maximize the posterior distribution of the enumerated composite event rules given the training labels.
This is done by using Neural TLP but with two changes.
First we freeze all model parameters as done in a deterministic setting.
Second, instead of learning the attention weights W we count the cooccurrences of relations computed through M R and the training labels for each sample.
To compute W , we start with all the observed time series samples T , Y = {T } mi =1 , { y } mi =1 .
Instead of operating over T we are interested in the grounded relational data R =
{ M R } mi =1 , which can be extracted through the prior stages of the Neural TLP pipeline through the TLN network g θ with fixed relations, as described in 3.1.
Given the inferred M R data, we have pairs of M k R , y k for each sample of k ∈ [1 , m ] .
Then we compute the co-occurrences of grounded predicates p and labels y as:
[Equation]
This W is used for rule learning in the same manner as Neural TLP for both fixed and variable length strategies.
To compute mAP we always predict the top ¯ y most frequently occurring labels in the training set.
D CATER
We explore composite action prediction over complex videos in the CATER data set (Girdhar &
Ramanan, 2019).
The CATER data set provides synthetic videos of multiple objects performing different actions simultaneously over the duration of the videos.
The atomic events are a conjunction of these movements ∈ {rotate, slide pick-place, contain} and objects ∈ {cone, cube, sphere, snitch} .
Such an atomic event is slide cone ∈ X where |X| = 14 and temporal predicates r ∈ { before, during, after } .
The composite event rules are composed of a single grounded temporal predicate ( n = 1 ) between two atomic events.
For example the underlying composite events in the video such as before(pick-place cube,rotate snitch) is assigned to label 2, providing | y | =unique composite events.
Only the label along with the videos are provided during training, while the rules are unknown.
Furthermore all these atomic events occur randomly during the video, thus multiple labels corresponding the the underlying temporal rule are active.
This provides a difficult, yet practical challenge: we know what coarse composite events occur during a timeline, but we want to recover the underlying atomic events and predicates (rules) leading to each of these composite events (labels) as shown in Figure 5.
Since the videos are generated with underlying rule templates, we can objectively test our models to recover these rules.
For our experiments we used the train, validation, and test splits provided in original dataset.
D. P REDICTED A TOMIC E VENTS
[Table]
Using the original CATER video data we performed experiments where the atomic events were provided and where we inferred the atomic events.
The latter case is more difficult, yet more realistic for rule recovery over collected data where noise exists.
To infer the atomic events we first tune a
Faster R-CNN (Ren et al., 2015) over the object bounding boxes.
In real world use cases it may
[Table]
Then we test the contribution of each parameter in relation learning.
Finally we test additional optimization strategies.
be possible to use pre-trained detectors to lift these bounding boxes, but they typically don’t cover synthetic objects.
We use these bounding boxes to generate a visual feature over the cropped image using a pre-trained ResNet-
(He et al., 2016).
We use the image feature and optical flow from the previous and next frame to predict the shape and movement.
There is additional difficulty performing this inference and we present the event accuracy in Table 6.
Furthermore, the action contain is hard to distinguish from pick-place , so additional rules are used to disambiguate pick-place from contain , leading to additional uncertainty.
The rule classified contain if the movement is a pick-place and the bounding box of the moving object is close to the bounding box of a static object.
Since each object has its own atomic actions we assigned a timeline for each object, tracking a max of k = 30 objects.
D. M ODEL A BLATION
We ablate our model over the predicted atomic event data in Table 7.
In the first section we test different convolution kernel sizes which contains a 1d covolution weight that is learned per atomic event |X| =
14 and a stride.
We see that convolution smoothing is beneficial at the reduced dimension of t = 150 and use this for further ablations.
In the next section we test how much each relation parameter contributes to the result.
The convolution weights are fixed to 1 , and we see that in this case they contribute minimally to rule induction.
In real world cases with more complex events, these learned convolutions could potentially be more useful if systematic noise exists.
For the convolution scalar α it is crucial to shift the compressed timeline to correctly identify event time intervals, as seen when it is fixed to 1.
Similarly when shift β = 0 and scale γ = 1 , it misses on variations in the relation data.
In the final section we test our L 1 regularization to produce sparser results for W .
This shows to enable better rule induction.
We test projecting W between [0 , 1] and while we got similar results, we notice that the optimization converges faster and in a more stable fashion.
We primarily focused on rule precision by looking at Hits@1, while increasing recall produced similar results for all methods in the setting where the rules only have n = 1 predicate.
D. D ATA A BLATION
To test different rule lengths n , training samples m , and event complexity ¯ y , we generated more
CATER-like data to explore these dataset statistics.
Here we use the same atomic events and relations as in the original dataset.
Due to the number of possible combinations of the dataset statistics, it is expensive to generate the video data and run our vision pipeline to generate the predicted atomic events.
Instead we opted to simulate the atomic event predictions directly.
For each sample we:
Randomly sample j rules containing up to n predicates.
[Table]
[Figure]
Synthesize a timeline for each rule, where atomic events are placed in the timeline consistent with the rule.
Each atomic event prediction was sampled from a normal distribution, with means centered around the atomic event detection accuracies in Table 6. 3.
Based on the synthesized timeline over sampled rules, add any consistent rules induced by the synthesized timeline.
These additional consistent rules contribute to our j ≤ ¯ y estimate.
Gaussian noise was also added along the timeline where events did not occur to simulate detection noise.
Given the synthesized timeline and the consistent rules, the corresponding M T and labels y can be generated for each sample.
For validation and testing data we generated 2500 samples each, regardless of the number of training samples.
From this base data set, we first vary the max rule length n of the rule samples and fix j = 1 to isolate the effect of the rule length.
For every level n we sample 100 total rules up to the max length n for consistency.
Breaking down the variable length accuracy in Table 8 we see Neural TLP provides better performance for shorter rules, while rule learning becomes more difficult for longer rules.
We also test the event j and data points m sample complexity in Figure 6.
As we sample more events j , more noise is added to our timeline and makes it harder for models to recover the underlying rules.
Inversely we also show the performance increases with the number of samples, where Neural TLP is more sample efficient.
E MIMIC-III
after(oral water, spo2_sao2 high)
∧ after(oral water, paco2 high) after(hco3 high, spo2_sao2 high) ∧ after(spo2_sao2 high, calcium high) after(hco3 high, spo2_sao2 high) ∧ before(hco3 normal, pao2 low)
[Table]
For the healthcare data we use the MIMIC-III dataset (Johnson et al., 2016).
The dataset contains measurements, vitals, and medications for intensive care patients, and is already de-identified .
We first filter the patients containing ICD codes corresponding to sepsis and sample 2k patients.
Instead of inferring patient survival directly, the medical doctors suggested to look at circulatory indicators, specifically urine flow.
Additionally they helped us identify a subset of patient vitals and measurements to use for urine flow, leading to our |X| =
82 boolean atomic events.
From the 2k patients we identify timepoints containing urine information.
This serves as a label, and all events before the urine event are the timeseries inputs.
Since patients had multiple indicators of urine during their stay we have 3.8k samples of time series and urine label (normal or low).
During training we created an 80/20 split for training and validation respectively.
After training and iterative feedback from the doctors, we successfully lifted useful indicators of urine flow as presented in Table 9.
A description of the atomic events is presented here in Table 10.