E XPLORING THE INTERPRETABILITY OF LSTM NEURAL NETWORKS OVER MULTI - VARIABLE DATA
Anonymous authors
Paper under double-blind review
A BSTRACT
In learning a predictive model over multivariate time series consisting of target and exogenous variables, the forecasting performance and interpretability of the model are both essential for deployment and uncovering knowledge behind the data.
To this end, we propose the interpretable multi-variable LSTM recurrent neural network (IMV-LSTM) capable of providing accurate forecasting as well as both temporal and variable level importance interpretation.
In particular, IMV-LSTM is equipped with hidden state matrix and update process, so as to learn variableswise hidden states.
On top of it, we develop a mixture attention mechanism and associated summarization methods to quantify the temporal and variable importance in data.
Extensive experiments using real datasets demonstrate the prediction performance and interpretability of IMV-LSTM in comparison to a variety of baselines.
It also exhibits the prospect as an end-to-end framework for both forecasting and knowledge extraction over multi-variate data.
I NTRODUCTION
Our daily life is now surrounded by various types of sensors, ranging from smart phones, video cameras, Internet of things, to robots.
The observations yield by such devices over time are naturally organized in time series data (Qin et al., 2017; Yang et al., 2015).
In this paper, we focus on multivariable time series consisting of target and exogenous variables.
Each variable corresponds to a monitoring over physical world.
A predictive model over such multi-variable data aims to predict the future values of the target series using historical values of target and exogenous series.
In addition to forecasting, the interpretability of prediction models is essential for knowledge extraction, variable selection and so on (Hu et al., 2018;
Foerster et al., 2017; Lipton, 2016).
For multi-variable time series in this paper, we focus on two types of importance interpretation.
Variable-wise temporal importance: exogenous variables present different temporal inﬂuence on the target one (Kirchgässner et al., 2012).
For instance, for the exogenous variable instantaneously correlated to the target one, its historical data at short time lags is expected to high importance values.
(2) Overall variable importance: exogenous variables and the auto-regressive part of the target variable differ in predictive power, which reﬂects different variable importance w.r.t.
the prediction of the target (Feng et al., 2018; Riemer et al., 2016).
The ability to unveil such knowledge through predictive models enables to fundamentally understand the relevance of exogenous variables to the target one.
Recently, recurrent neural networks (RNNs), especially long short-term memory (LSTM) (Hochreiter & Schmidhuber, 1997) and the gated recurrent unit (GRU) (Cho et al., 2014), have been proven to be powerful sequence modeling tools in a variety of tasks such as language modelling, machine translation, health informatics, time series, and speech (Ke et al., 2018; Lin et al., 2017; Lipton et al., 2015; Sutskever et al., 2014; Bahdanau et al., 2014).
However, current RNNs fall short of the aforementioned interpretability for multi-variable data due to their opaque internal states.
Speciﬁcally, when fed with the multi-variable observations of the target and exogenous variables, RNNs blindly blend the information of all variables into memory cells and hidden states which are used for prediction.
It is intractable to distinguish the contribution of individual variables into the prediction through hidden states (Zhang et al., 2017).
Recently, attention-based neural networks have been proposed to enhance the ability of RNN in selectively using long-term memory and the interpretability (Vaswani et al., 2017; Qin et al., 2017; Choi et al.,
Vinyals et al., 2015; Chorowski et al., 2015; Bahdanau et al., 2014).
Nevertheless, current attention mechanism is mostly applied to hidden states across time steps and capture globally temporal information, thereby failing to uncover ﬁne-grained variable level importance.
To this end, in this paper we build interpretable LSTM models with the aim to achieve a uniﬁed framework of forecasting and knowledge extraction.
In particular, the contribution is fourfold.
First, we propose the interpretable multi-variable LSTM, referred to as IMV-LSTM, with hidden state matrix and updating scheme, such that each element of the hidden state matrix encodes information for a certain input variable.
Second, based on these variable-wise hidden states we develop a novel mixture temporal and variable attention mechanism.
Third, attention values are further summarized to quantify variable-wise temporal importance and overall variable importance.
Lastly, we perform extensive experimental evaluation of IMV-LSTM against statistical, machine learning and neural network baselines to demonstrate the superior prediction performance and interpretability of IMVLSTM.
The idea of IMV-LSTM easily applies to other RNN structures, e.g. GRU and stacked recurrent layers.
This will be the future work.
R ELATED WORK
In time series analysis, prediction with exogenous variables can formulated as an auto-regressive exogenous model or prediction modeles deﬁned on exogenous variables.
Vanilla RNNs have been used to study it in (Zemouri et al., 2010; Diaconescu, 2008), where interpretability was not investigated.
Recent research on the interpretability of RNNs is categorized into two groups: attention methods and post-analyzing over trained models.
Attention mechanism has gained tremendous popularity (Xu et al., 2018;
Choi et al., 2018;
Guo et al., 2018; Lai et al., 2017; Qin et al., 2017; Cinar et al., 2017;
Choi et al., 2016; Vinyals et al., 2015; Bahdanau et al., 2014).
However, current attention mechanism is mainly applied to hidden states across time steps.
(Qin et al., 2017; Choi et al., 2016) use weighted input data learned by encoder networks to do forecasting.
Weighting input data by attention does not consider the direction of correlation with the target.
Moreover, this attention is derived from the hidden states encoding all input variables and thus each element of the attention is composed of contributions from all input variables.
Using such attention to interpret variabel importance is biased.
It fails short of interpretability on variable-wise temporal importance as well.
As for post-analyzing based interpretation, (Murdoch et al., 2018; Murdoch & Szlam, 2017; Arras et al., 2017) extracted temporal importance scores over words or phrases of individual language sequences by decomposing the memory cells of trained LSTM.
(Chu et al., 2018) proposed interpretation solutions for piece-wise linear neural networks.
In (Wang et al., 2018), it quantiﬁed the importance of each middle layer to the output.
(Foerster et al., 2017) introduced input-switched afﬁne transformations into RNNs, which analyzed the contribution of input steps via linear methods.
Above work focuses on global temporal importance and does not support variable speciﬁc temporal interpretation.
Our following proposed IMV-LSTM is a combination of attention and post-analyzing for multi-variable time series, where novel variable-wise hidden states and mixture attention enable ﬁne-grained temporal and variable importance interpretation during the training.
Another line of related research is about tensorization and selectively updating of hidden states in
RNNs.
(Do et al., 2017; Novikov et al., 2015) proposed to represent hidden states as a matrix.
(He et al., 2017) developed tensorized LSTM to enhance the capacity of networks without additional parameters.
(Kuchaiev & Ginsburg, 2017; Neil et al., 2016; Koutnik et al., 2014) put forward to partition the hidden layer into separated modules with different updates.
The hidden state tensors and update processes in existing works do not maintain variable-wise correspondence, thereby lacking the desirable interpretability.
I NTERPRETABLE M ULTI -V ARIABLE LSTM
Assume we have N - 1 exogenous time series and a target series y of length T , where y =
[ y 1 , · · · , y T ] and y ∈ R T .
By stacking exogenous time series and target series, we deﬁne a multi-variable input series as X T = { x 1 , · · · , x T } , where x t = [ x 1 t , · · · , x N − 1 t , y t ] .
Both of x nt and y t can be multidimensional vector.
x t ∈ R N is the multi-variable input at time step t .
Given X T , we aim to learn a non-linear mapping to predict the next values of the target series, namely ˆ y T
+1 =
F ( X T ) .
Meanwhile, through trained model F ( · ) , we aim to extract variable-wise temporal importance and overall variable importance w.r.t.
the prediction from the data.
The following described IMVLSTM can be easily extended to multi-step ahead prediction via iterative methods as well as vector regression (Fox et al., 2018; Cheng et al., 2006).
3. N ETWORK A RCHITECTURE
In IMV-LSTM we develop hidden state matrix and update scheme, which ensure that each element of the hidden state matrix encapsulates information exclusively from a certain variable of the input.
It gives rise to mixture attention on both variable and temporal aspects and ﬁne-grained interpretation described below.
To distinguish from the hidden state and gate vectors in a standard LSTM, hidden state and gate matrices in IMV-LSTM are denoted with tildes.
Speciﬁcally, we deﬁne the hidden state matrix at time step t as ˜h t =
[ h 1 t , · · · , h Nt ] (cid:62) , where ˜h t ∈ R N × d , h nt ∈ R d .
The overall size of the layer is derived as D = N · d .
The element h nt of ˜h t is the hidden state vector speciﬁc to n -th input variable.
Then, we deﬁne the input-to-hidden transition as U j =
[ U 1 j , · · · , U Nj ] (cid:62) , where U j ∈ R N ×
d × d 0 ,
U
nj ∈ R d × d 0 and d 0 is the dimension of individual variables at each time step.
The hidden-to-hidden transition is deﬁned as: W j = [ W 1 j , · · · , W Nj ] , where W j ∈ R N × d × d and W nj ∈ R d × d .
As standard LSTM neural networks (Hochreiter & Schmidhuber, 1997), IMV-LSTM has the input i t , forget f t , output gates o t and the memory cells c t in the update process.
Given the newly incoming input x t at time t and the hidden state matrix ˜h t − 1 , the hidden state update is deﬁned as:
[Equation]
where ˜j t =
[ j 1 t , · · · , j Nt ] (cid:62) has the same shape as hidden state matrix (i.e. R N × d ).
Each element j nt ∈ R d corresponds to the update of the hidden state w.r.t.
input variable n .
Term W j (cid:126)
˜h
t −and
U j (cid:126) x t respectively capture the update from the hidden states at the previous step and the new input.
The tensor-dot operation (cid:126) is deﬁned as the product of two tensors along the N axis, e.g.,
W
[Equation]
· · · , W N j h N t − 1 ] (cid:62) where W n j h n t − 1 ∈ R d .
Depending on different update schemes of gates and memory cells, we proposed two realizations of
IMV-LSTM, i.e. IMV-Full in Equation set 1 and IMV-Tensor in Equation set 2.
In these two sets of equations, vec ( · ) refers to the vectorization operation, which concatenates columns of a matrix into a vector.
⊕ is the concatenation operation.
(cid:12) denotes element-wise multiplication.
In this paper, matricization ( · ) reshapes a vector of R D into a matrix of R N × d .
[Equation]
Equation set 1: IMV-Full
[Equation]
Equation set 2: IMV-Tensor
IMV-Full : With vectorization in Eq.
(2) and (3), IMV-Full updates gates and memories using full ˜h t − 1 and ˜j t regardless of the variable-wise data in them.
By simple replacement of the hidden update in standard LSTM by ˜j t , IMV-Full behaves identically to standard LSTM while enjoying the interpretability shown below.
IMV-Tensor :
By applying tensor-dot operations in Eq.
(5), gates and memory cells are matrices as well, elements of which have the correspondence to input variables as hidden state matrix ˜h t does.
W and U have the same shapes as W j and U j in Eq.
In IMV-Full and IMV-Tensor, gates only scale ˜j t and ˜c t − 1 and thus retain the variable-wise data organization in ˜h t .
Meanwhile, based on tensorized hidden state Eq.
(1) and gate update Eq.
IMV-Tensor can also be considered as a set of parallel LSTMs, each of which processes one variable series.
The derived hidden states speciﬁc to individual variables are aggregated on both temporal and variable level through the attention described below.
3. M IXTURE A TTENTION
After feeding a sequence of { x 1 , · · · , x T } into either IMV-Full or IMV-Tensor, we obtain a sequence of hidden state matrices { ˜h 1 , · · · , ˜h T } , where the sequence of hidden states speciﬁc to variable n is extracted as { h n 1 , · · · , h nT } .
In this part, we present the novel mixture attention mechanism in IMV-LSTM based on the following idea.
Temporal attention is ﬁrst applied to the sequence of hidden states corresponding to each variable, so as to obtain the summarized history of each variable.
Then by using the history enriched hidden state of each variable, global variable attention is derived.
These two steps are assembled into a probabilistic mixture model (Zong et al., 2018; Graves, 2013; Bishop, 1994), which facilitates the subsequent training, inference, and interpretation process.
In particular, the mixture attention is formulated as:
[Equation]
In Eq.
(8), we introduce a latent random variable z T +1 into the the density function of y T + to govern the generation process.
z T +1 is a discrete variable over the set of values { 1 , · · · , N } corresponding to N input variables.
Mathematically, p ( y T +1 | z T +1 = n, h nT ⊕ g n ) characterizes the density of y T +1 conditioned on historical data of variable n , while the prior of z T +1 , i.e. p ( z T +1 = n | h 1 T ⊕ g 1 , · · · , h N T ⊕ g N ) controls to what extent y T +1 is driven by variable n .
The context vector g n is computed as the temporal attention weighted sum of hidden states corresponding to variable n , i.e., g n = (cid:80) t
α nt h nt where attention weight
α nt =
exp( f n ( h nt ))
(cid:80) k exp( f n ( h nk )) .
f n ( · ) can be a ﬂexible function speciﬁc to variable n , e.g., neural networks (Bahdanau et al., 2014).
The p ( y T +1 | z T +1 =
n, h nT ⊕ g n ) is a Gaussian distribution parameterized by [ µ n , σ n ] =
ϕ n ( h nT ⊕ g n ) , where ϕ n ( · ) can be a feedforward neural network.
The overall variable attention p ( z T +1 =
n | h 1 T ⊕ g 1 , · · · , h NT ⊕ g N ) is derived by a softmax function over { f ( h nT ⊕ g n ) } N , where f ( · ) can be a feedforward neural network shared by all variables.
3. L EARNING , I NFERENCE , AND I NTERPRETATION
In the learning phase, the set of parameters in IMV-Full or IMV-Tensor as well as the attention functions is denoted by Θ .
Given a set of M training sequences { X T } M and { y T +1 } M , the loss function to optimize is deﬁned based on the negative log likelihood of the mixture attention model in
Eq.
(8) plus regularization terms.
In the inference phase, the prediction of y T +1 is obtained by the weighted sum of means as : ˆ y T +
=
(cid:80) n µ n · p ( z T +1 =
n | h 1 T ⊕ g 1 , · · · , h NT ⊕ g N ) .
Regarding interpretation, we ﬁrst illustrate the burden of deciphering variable and temporal importance from the raw attentions mentioned above.
For instance, during the training on PLANT dataset used in the experiment section, we collect variable-wise temporal attention and overall variable attention values w.r.t.
each training instance at each epoch.
In Fig 2, Panel (a) plots the histograms of overall variable attention of three variables in PLANT at two different epochs.
Ideally, attention weights of different variables are expected to distribute distinctly.
However, through histograms in
Panel (a) it is nontrivial to fully discriminate variable importance.
Likewise, in Panel (b) plotting the histogram of temporal attention at some time lags of variable “P-temperature” at two different epochs does not ease the importance interpretation.
Time lag represents the look-back time step w.r..t the current one.
Similar phenomena are observed in other variables and datasets during the experiments.
[Figure]
Therefore
[Figure]
we proposed the following summarization method over temporal and variable attentions of data instances to quantify temporal and variable importance.
First, we deﬁne the function f agg :
R A × B → R B , which maps an input
Z ∈ R
A × B into an aggregated vector ¯z ∈ R B .
In the present paper
[Figure]
we choose the simple normalized summation function as:
[Equation]
It is ﬂexible to choose alternative functions for f agg , e.g. robust statistics based methods, etc.
For temporal importance, we collect the temporal attention w.r.t.
n -th variable of each instance m as α nm =
[ α nm, 1 , · · · , α nm,T − 1 ] ∈ R T − 1 .
Then, the uniﬁed temporal importance of variable n is obtained as ¯ α n = f agg
([ α n 1 , · · · , α nM ] (cid:62) ) , (cid:80) t ¯ α nt = 1 , ¯ α nt ∈ [0 , 1] .
The overall variable importance is formulated by using a novel posterior variable attention.
Concretely, the posterior variable attention is derived as:
[Equation]
where q n provides more distinguishable attention distribution of different variables by taking the predictive likelihood into account.
For instance, Panel (c) in Fig.
(2) demonstrates the histograms of posterior and prior attention (i.e. p ( z T
+1 =
n | X T ) ) of two example variables in PLANT.
Compared with priors, the posterior attentions of more important variable “Temperature” further shift rightward, while the posterior of less important variable “P-temperature” moves towards zero.
The uniﬁed variable importance can then be deﬁned as ¯ q = f agg ([ q 1 , · · · , q M ] (cid:62) ) , (cid:80) n ¯ q n = 1 , ¯ q n ∈ [0 , 1] , where q m =
[ q 1 m , · · · q Nm ] ∈ R N is the overall variable attention of instance m .
E XPERIMENTS 4. D ATASETS
NASDAQ is the dataset from (Qin et al., 2017).
It contains 81 major corporations under NASDAQ 100, as exogenous time series.
The index value of the NASDAQ 100 is the target series.
The frequency of the data collection is minute-by-minute.
The ﬁrst 35,100, the following 2,730 and the last 2, data points are respectively used as the training, validation and test sets.
PLANT: This dataset records the time series of energy production of a photo-voltaic power plant in Italy (Ceci et al., 2017).
Exogenous data consists of 9 weather conditions variables (such as temperature, cloud coverage, etc.).
The power production is the target.
It provides 20842 sequences split into training ( 70% ), validation ( 10% ) and testing sets ( 20% ).
SML is a public dataset used for indoor temperature forecasting.
Same as (Qin et al., 2017), the room temperature is taken as the target series and another 16 time series are exogenous series.
The data were sampled every minute.
The ﬁrst 3200, the following 400 and the last 537 data points are respectively used for training, validation, and test.
4. B ASELINES AND E VALUATION S ETUP
The ﬁrst category of statistics baselines includes:
STRX is the structural time series model with exogenous variables (Scott & Varian, 2014; Radinsky et al., 2012).
It is formulated in terms of unobserved components via the state space method.
ARIMAX is the auto-regressive integrated moving average with regression terms on exogenous variables (Hyndman & Athanasopoulos, 2014).
It is a special case of vector auto-regression in this scenario.
The second category of machine learning baselines includes:
RF refers to random forests.
It is an ensemble learning method consisting of several decision trees (Liaw et al., 2002; Meek et al., 2002) and was used in time series prediction (Patel et al., 2015).
XGT refers to the extreme gradient boosting (Chen & Guestrin, 2016).
It is the application of boosting methods to regression trees (Friedman, 2001).
ENET represents Elastic-Net, which is a regularized regression method combining both L1 and L penalties of the lasso and ridge methods (Zou & Hastie, 2005) and has been used in time series analysis (Liu et al., 2010; Bai & Ng, 2008).
The third category of neural network baselines includes:
RETAIN uses RNNs to respectively learn weights on input data, which are then used to perform prediction (Choi et al., 2016).
DUAL is an encoder-decoder architecture, which uses an encoder LSTM to learn weights and then feeds pre-weighted input data into a decoder LSTM for forecasting (Qin et al., 2017).
In ARIMAX, the orders of auto-regression and moving-average terms are set via the autocorrelation and partial autocorrelation.
For RF and XGT, the hyper-parameter tree depth and the number of iterations are chosen from range [3 , 10] and [2 , 200] via grid search.
For XGT, L2 regularization is added by searching within { 0 . 0001 , 0 . 001 , 0 . 01 , 0 . 1 , 1 , 10 } .
As for ENET, the coefﬁcients for L2 and
L1 penalties are selected from { 0 , 0 . 1 , 0 . 3 , 0 . 5 , 0 . 7 , 0 . 9 , 1 , 1 . 5 , 2 } .
For machine learning baselines, multi-variable input sequences are ﬂattened into feature vectors.
We implemented IMV-LSTM and neural network baselines with Tensorﬂow 2 .
We used Adam with the mini-batch of 64 instances (Kingma & Ba, 2014).
For the size of recurrent and dense layers in the baselines, we conduct grid search over { 16 , 32 , 64 , 128 , 256 , 512 } .
The size of the IMV-LSTM layer is set by the number of neurons per variable selected from { 10 , 15 , 20 , 25 } .
Dropout is selected in { 0 . 8 , 0 . 5 } .
Learning rate is searched in { 0 . 0005 , 0 . 001 , 0 . 005 , 0 . 01 , 0 . 05 } .
L2 regularization is added with the coefﬁcient chosen from { 0 . 0001 , 0 . 001 , 0 . 01 , 0 . 1 , 1 . 0 } .
We train each approachtimes and report average performance.
For baseline DUAL on NASDAQ and SML datasets, we use the hyper-parameters achieving the best performance in Qin et al.
On PLANT dataset, hyper-parameters are searched in above sets of values.
The window size for NASDAQ and SML, namely T in Sec. 3, is set to 10 according to Qin et al.
(2017), while for PLANT it is 20 to test long temporal dependency.
We consider two metrics to measure the prediction performance.
Speciﬁcally, RMSE is deﬁned as
RMSE =
(cid:112)(cid:80) m ( y m − ˆ y m ) 2 /M .
MAE is deﬁned as MAE =
(cid:80) m | y m − ˆ y m | /M .
4. P REDICTION P ERFORMANCE
We report the prediction errors in Table 1, each cell of which presents the average RMSE and MAE with standard errors.
Note that IMV-Full and IMV-Tensor are single network structures.
Their good prediction performance below veriﬁes the idea that instead of complex network architecture in baselines, simple and proper mixture of well-maintained variable-wise hidden states also improves the prediction performance as well as empowering the interpretability shown below.
In particular,
IMV-LSTM family outperforms baselines by around 80% at most.
IMV-Full performs mostly better than baselines, while IMV-Tensor surpasses IMV-Full on NASDAQ and SML datasets.
[Table]
4. I NTERPRETATION
In this part, we investigate the interpretability of IMV-Full and IMV-Tensor by collecting the variable and temporal importance values during the training under the best hyper-parameters.
As far as we know, experiments in previous work using attention in RNNs do not unveil such ﬁne-grained interpretation over both variable and temporal level.
Due to the page limitation, the interpretability results on other datasets are in the appendix section.
In Fig.
3, Panel (a) shows the overall variable importance values w.r.t.
training epochs on PLANT dataset.
Speciﬁcally, as variable importance converges, the ranking of variables is clearly identiﬁed at the end of the training, i.e. variables with high importance values are top ranked.
Meanwhile, Panel (b) demonstrates the temporal importance values of each variable at the beginning and ending of the training (i.e. epoch 0 and 75).
The lighter the color, the higher the temporal importance value of the corresponding time lag.
At epoch 0, the randomly initialized network gives rises to similar temporal importance pattern for most of the variables.
At epoch 75, diverse patterns w.r.t different variables are learned.
For instance, the importance value at around time lag 1 to 4 of variable "P-temperature" are obviously higher, which indicates that this variable has instant relation to the target.
For variable "wind-speed", this heat map tells that its historical observations after time lag 14 could be negligibly correlated to the target.
Panel (c) shows the convergence of the variable importance of IMV-Tensor on PLANT dataset.
The ranking of variable importance is slightly different to that in Panel (a).
It is because in IMV-Tensor the gate and memory update scheme makes hidden states w.r.t.
different variables evolve independently, 2 Code be released requested.
thereby leading to different hidden states and attention values to IMV-Full.
However, we can still decipher something in common.
For instance, variable "wind-speed" stays relatively important in both Panel (a) and (c),
i
[Figure]
e. rank 1st and 4th respectively.
As for temporal importance, in Panel (d) variable "P-temperature" presents temporal importance pattern similar to that in Panel (b).
It is also worth exploring whether we can obtain more consistent variable and temporal importance from
IMV-Full and IMV-Tensor in the future work.
[Figure]
[Figure] [Figure]
[Figure]
4. V ARIABLE IMPORTANCE FOR PREDICTION
In this group of experiments, we evaluate the efﬁcacy of variable importance through the lens of prediction tasks.
We focus on IMV-LSTM family and RNN baselines, i.e. DUAL and RETAIN.
Speciﬁcally, for each approach, we ﬁrst rank variables respectively according to the variable importance in IMV-LSTM and variable attention in DUAL and RETAIN.
Then we rebuild datasets only consisting of top 50% ranked variables for each approach (i.e. high importance or attention values) to retrain each model and obtain the prediction errors in Table 2.
(The full ranking of variables is in the appendix.)
Ideally, effective variable importance leads to top variables highly related to the target and thus retrained models have comparable errors in comparison to their counterparts in Table 1.
In particular,
IMV-Full and IMV-Tensor present comparable and even lower errors in Table 2, while DUAL and
RETAIN have higher errors mostly.
An additional advantage of using top variables is the training efﬁciency, e.g. the training time of each epoch in IMV-Tensor is reduced from ∼ 16 sec to ∼ 11 sec.
[Table]
C ONCLUSION
In this paper
[Table]
we propose an interpretable multi-variable LSTM (IMV-LSTM) for time series with exogenous variables.
Based on the hidden state matrix and update scheme
[Table]
we present two realizations
i
[Table]
e. IMV-Full and IMV-Tensor as well as developing mixture temporal and variable attention mechanism.
It enables to infer and quantify ﬁne-grained variable-wise temporal importance and overall variable importance w.r
[Table]
t. the target.
Extensive experiments exhibit the superior prediction performance, interpretability and efﬁcacy of variable importance of IMV-LSTM.
A PPENDIX 6. I NTERPRETABLE M ULTI -V ARIABLE LSTM
In IMV-Full and IMV-Tensor, the learning phase aims to minimize the loss function as follows:
[Equation]
The derivation of the posterior attention is as follows.
This equation is based on the Bayesian rule to derive the posterior of variable attention, by taking into account both the predictive likelihood w.r.t.
the corresponding variable and prior attention.
[Equation]
where the p ( y T +1 | z T +1 = n, h nT ⊕ g n ) is a Gaussian distribution parameterized by [ µ n , σ n ] =
ϕ n ( h nT ⊕ g n ) , where ϕ n ( · ) can be a feedforward neural network.
Regarding the summarization of variable-wise temporal attention and variable attention of each instance, since each attention is a sample of discrete distribution (i.e. deﬁned on temporal steps and input variables), alternative summarization method is to ﬁt a Dirichlet distribution to these attentions and use the estimated expectation as the importance values.
Next, we provide the formal analysis about the complexity of IMV-LSTM through Lemma 6.1 and
Lemma 6.2.
Lemma 6.1.
Given time series of N variables, assume a standard LSTM and IMV-LSTM layer both have size D , i.e. D neurons in the layer.
Then, compared to the number of parameters of the standard LSTM, IMV-Full and IMV-Tensor respectively reduce the network complexity by ( N − 1) D
+ (1 − 1 /N )
D · D and 4( N − 1) D + 4(1 − 1 /N )
D · D number of parameters.
Proof.
In a standard LSTM of layer size D , trainable parameters lie in the hidden and gate update functions.
In total, these update functions have 4 D · D +4 N · D +4 D parameters, where 4 D · D +4 N · D comes from the transition and 4 D corresponds to the bias terms.
For IMV-Full, assume each input variable corresponds to one-dimensional time series.
Based on
Eq. 1, the hidden update has 2 D + D 2 /N trainable parameters.
Equation set 1 gives rise to the number of parameters equal to that of the standard LSTM.
Therefore, the reduce number of parameters is ( N − 1) D
+ (1 − 1 /N )
D · D .
As for IMV-Tensor, more parameter reduction stems from that the gate update functions in Equation set 2 make use of the tensor-dot operation as Eq. 1.
Likewise, the reduced amount of parameters can be derived.
Lemma 6.2.
For time series of N variables and the recurrent layer of size D , IMV-Full and IMVTensor respectively have the computation complexity at each update step as: O ( D 2 + N · D ) and
O ( D 2 /N + D ) .
Proof.
Assume that D neurons of the recurrent layer in IMV-Full and IMV-Tensor are evenly assigned to N input variables, namely each input variable has d = D/N corresponding neurons.
For IMV-Full, based on Eq.
1, the hidden update has computation complexity N · d 2 + N · d , while the gate update process has the complexity D 2 + N · D .
Overall, the computation complexity is O
( D 2 + N · D ) , which is identical to the complexity of a standard LSTM.
As for IMV-Tensor, since the gate update functions in Equation set 2 make use of the tensor-dot operation as Eq. 1, gate update functions have the same computation complexity as Eq. 1.
The overall complexity is O
( D 2 /N + D ) , which is 1 /N of the complexity of a standard LSTM.
Basically, Lemma 6.1 and Lemma 6.2 indicate that a high number of input variables leads to a large portion of parameter and computation reduction in IMV-LSTM family.
6. E XPERIMENTS
In this part, we provide complementary experiment results as well as the insights from the results.
6.2. P REDICTION PERFORMANCE ANALYSIS
Effect of exogenous variables
The ﬁrst new set of experiments reports the prediction errors of statistical, machine learning models and LSTM with attention trained with only auto-regressive data of the target variable.
By comparing with the results of the models using both the target and exogenous variables, it is aimed to demonstrate that adding exogenous variables beneﬁts the prediction performance.
This group of new results is put together with Table 1 into Table 3 below.
For uni-variable input,
DUAL, RETAIN and our IMV-LSTM reduce to a standard LSTM with temporal attention, and thus we report the results under the name of LSTM-Att in Table 3.
In Table 3, it is observed that the models trained with both target and exogenous variables obtain lower errors.
IMV-Tensor mostly outperforms IMV-Full.
Though IMV-Full performs a little better than IMV-Tensor on PLANT dataset, they are quite comparable.
IMV-Tensor has a much lower error (e.g. 50% less at the maximum) for the rest of experiments.
Effect of the target variable Meanwhile, we add another group of experiments to evaluate the performance of IMV-LSTM without the target variable.
For the ease of comparison, the prediction errors of IMV-LSTM on data including and excluding the target variable are put together in Table 4.
In comparison to using the target variable, IMV-LSTM family presents comparable prediction performance without the target variable, though the errors arise a little.
Error increases by around 20% without using the target variable.
It suggests that in the experiment datasets, overall exogenous variables are correlated to the target and contribute to the prediction.
Auto-regressive history also has the certain correlation to the future of the target variable.
Insights from the results The superior experimental performance of IMV-Tensor demonstrates a meaningful phenomenon.
For multi-variable data, properly modeling individual variables and their interaction in LSTM is not only important for the performance, but also brings additional beneﬁts, i.e. the interpretability in this paper.
Speciﬁcally, when using LSTM on multi-variable data [Table] the conventional way is to directly feed multi-variable data into LSTM for target prediction.
IMV-Full decomposes the hidden states, as well as keeping the variable interaction in the gate updating.
IMV-Tensor goes one step further.
It amounts to ﬁt parallel LSTMs into the probabilistic mixture framework.
It allows to ﬁrst model individual variables and then collectively perform the prediction via the mixture attention.
As a result, it enjoys theoretical soundness, even better prediction performance as well as interpretability
[Table]
[Table]
[Table]
6.2. V ISUALIZATION OF PREDICTION ERRORS
In this part, the prediction testing errors of IMV-LSTM family are visualized.
Fig.
4 shows the Q-Q plot of testing errors on each dataset.
Fig.
5 demonstrates the testing error curve during the training phase.
Basically, we can observe that IMV-Tensor has lower prediction errors as well as more smooth testing error curves
[Figure]
a
[Figure]
p l e Q u a n t il e s
[Figure]
[Figure]
6.2. M ODEL I NTERPRETATION
In this part, we exploit the domain knowledge in the literature corresponding to the dataset, so as to qualitatively explain the importance learned by IMV-LSTM.
Fig.
6 – 9 show the quantitative variable-wise temporal and variable importance values of IMV-LSTM on different datasets.
Note that not all datasets in the experiments have associated study of variable importance in the literature.
PLANT dataset has some related work on analyzing effective factors on energy production, therefore we will focus on explaining PLANT dataset with domain knowledge.
For PLANT dataset, as is discussed in (Mekhilef et al., 2012; Ghazi & Ip, 2014), wind and humidity affect the efﬁciency of photovoltaic cells and they are relatively high ranked by our variable importance.
Humidity causes dust deposition and settlement and consequentially degradation in solar cell efﬁciency.
Increased wind can move more heat from the PV cell surface as well as lowering the humidity of the atmospheric air in the surroundings, which leads to better efﬁciency. Also we obervat
For SML dataset, IMV-Tensor and IMV-Full share some variable importance in common.
For instance, for the experiments in Sec.
4.5 on the SML dataset, in Table 7 they share 5 variables in common among the top 50% variables (i.e. 8 variables) of each method.
Some of the different variables in top 50% refer to the similar concept, e.g. CO2 dining and CO2 room.
Considering the superior prediction performance of IMV-Tensor shown in Table 3 and Table 2, IMVTensor’s importance values are favored.
However, the difference between the importance learned by
IMV-Full and IMV-Tensor still needs further investigation both theoretically and experimentally in the future work.
[Figure]
[Figure]
[Figure]
[Figure]
In the following Table 5, 6, and 7, we list the full ranking of variables of the datasets by each approach.
Variables associated with the importance or attention values are ranked in decreasing order.
[Figure]
V a r i a b l e i
[Figure]
p o r t a n c
[Figure]
AALAAPLADBEADIADPADSKAKAMALXNAMATAMGNAMZNATVIAVGOBBBYBIDUBIIBCA
CELGCERNCMCSACOSTCSCOCSXCTRPCTSHDISCADISHDLTREAEBAYESRXEXPEFASTFB
FOXFOXAGILDGOOGLINTCJDKHCLBTYALBTYKLRCXMARMATMCHPMDLZMSFTMU
MXIMMYLNCLHNFLXNTAPNVDANXPIPAYXPCARPYPLQCOMQVCAROSTSBUXSIRISTX
SWKSSYMCTMUSTRIPTSCOTSLATXNVIABVODVRTXWBAWDCWFMXLNXYHOOAuto
[Figure] [Figure]
[Figure]
SIRISTXSWKSSYMCTMUSTRIPTSCOTSLATXNVIABVODVRTXWBAWDCWFMXLNXYHOO
[Figure]
[Figure] [Figure]
[Figure] [Figure]
[Figure] [Figure]
[Figure] [Figure]
[Figure]
V a r i a b l e i m p
o r t a n c e
AALAAPLADBEADIADPADSKAKAMALXNAMATAMGNAMZNATVIAVGOBBBYBIDUBIIBCA
CELGCERNCMCSACOSTCSCOCSXCTRPCTSHDISCADISHDLTREAEBAYESRXEXPEFASTFB
FOXFOXAGILDGOOGLINTCJDKHCLBTYALBTYKLRCXMARMATMCHPMDLZMSFTMU
MXIMMYLNCLHNFLXNTAPNVDANXPIPAYXPCARPYPLQCOMQVCAROSTSBUXSIRISTX
SWKSSYMCTMUSTRIPTSCOTSLATXNVIABVODVRTXWBAWDCWFMXLNXYHOOAuto
[Figure]
importance
[Figure]
r.t. epochs.
[Figure] [Figure]
SIRISTXSWKSSYMCTMUSTRIPTSCOTSLATXNVIABVODVRTXWBAWDCWFMXLNXYHOO
[Figure] [Figure]
[Table] [Table]
, 0.003567, ’GOOGL’, 0.003622, ’COST’, 0.003678, ’INTC’, 0.003712, ’CTSH’, 0.003908, ’BBBY’, 0.004027, ’TRIP’, 0.004881, ’MAT’, 0.004956, ’ATVI’, 0.005121, ’LBTYK’, 0.00523, ’CERN’, 0.00524, ’CTRP’, 0.005283, ’ALXN’, 0.00536, ’VOD’, 0.005369, ’VRTX’, 0.005433, ’LBTYA’, 0.005445, ’MXIM’, 0.00554, ’BIIB’, 0.005554, ’EBAY’, 0.005555, ’BIDU’, 0.005605, ’FB’, 0.005654, ’VIAB’, 0.005685, ’GILD’, 0.005695, ’AMGN’, 0.005716, ’MYL’, 0.005737, ’YHOO’, 0.006166, ’KHC’, 0.006555, ’AMZN’, 0.006605, ’CSCO’, 0.007836, ’ESRX’, 0.010614, ’SWKS’, 0.012777, ’MDLZ’, 0.017898, ’CA’, 0.02198, ’EXPE’, 0.024373, ’QVCA’, 0.026462, ’EA’, 0.027808, ’TSLA’, 0.043082, ’ADBE’, 0.043829, ’JD’, 0.071079, ’SYMC’, 0.081596, ’PYPL’, 0.087612, ’DLTR’, 0.119737, ’TSCO’, 0.
RETAIN ’DLTR’, 0.000866, ’QVCA’, 0.001128, ’TSLA’, 0.00119, ’PYPL’, 0.00128, ’EA’, 0.001439, ’EXPE’, 0.001502, ’CA’, 0.001713, ’TSCO’, 0.001737, ’SYMC’, 0.002334, ’ADBE’, 0.00252, ’JD’, 0.002607, ’AMZN’, 0.003367, ’CSCO’, 0.003543, ’KHC’, 0.003996, ’CTSH’, 0.004695, ’NXPI’, 0.004865, ’EBAY’, 0.004963, ’SWKS’, 0.005011, ’MXIM’, 0.005135, ’MYL’, 0.005541, ’COST’, 0.006052, ’BIDU’, 0.006534, ’GOOGL’, 0.006906, ’INTC’, 0.007153, ’GILD’, 0.007212, ’ESRX’, 0.007512, ’NTAP’, 0.007695, ’QCOM’, 0.008037, ’CELG’, 0.008168, ’MDLZ’, 0.008829, ’AMGN’, 0.008998, ’FOX’, 0.009943, ’VIAB’, 0.010123, ’AAPL’, 0.010157, ’FB’, 0.010359, ’YHOO’, 0.010744, ’PAYX’, 0.010899, ’BBBY’, 0.01117, ’AKAM’, 0.012054, ’BIIB’, 0.012069, ’NFLX’, 0.012266, ’ADSK’, 0.012319, ’DISH’, 0.012338, ’LBTYA’, 0.012697, ’FOXA’, 0.01282, ’MCHP’, 0.012833, ’WFM’, 0.012869, ’STX’, 0.012887, ’VRTX’, 0.013318, ’SBUX’, 0.013458, ’VOD’, 0.013798, ’ALXN’, 0.013878, ’CTRP’, 0.013963, ’SIRI’, 0.01475, ’CERN’, 0.014777, ’LBTYK’, 0.014799, ’ATVI’, 0.015651, ’AVGO’, 0.016382, ’CMCSA’, 0.016531, ’TXN’, 0.016977, ’LRCX’, 0.017131, ’AMAT’, 0.017378, ’ROST’, 0.017399, ’MU’, 0.018045, ’TRIP’, 0.018236, ’MAT’, 0.018297, ’Auto-regressive’, 0.018626, ’WDC’, 0.019083, ’DISCA’, 0.019233, ’FAST’, 0.019392, ’CSX’, 0.019734, ’WBA’, 0.019984, ’AAL’, 0.021188, ’ADI’, 0.021215, ’NCLH’, 0.022932, ’NVDA’, 0.022994, ’TMUS’, 0.024187, ’MSFT’, 0.026354, ’ADP’, 0.028515, ’MAR’, 0.028783, ’PCAR’, 0.029459, ’XLNX’, 0.
[Table]
6.2. V ARIABLE IMPORTANCE FOR PREDICTION
In this part, we add a new group of experiments using Pearson correlation, to compare with the variable importance learned by IMV-LSTM.
In particular, the Pearson correlation is used to pre-select the top 50% variables with the highest (absolute) correlation values to the target variable.
Then
[Table]
we train IMV-Full and IMV-Tensor on the data consisting of these chosen variables.
For the ease of comparison, in Table 8 we put together the prediction errors of IMV-LSTM family on variables chosen by Pearson and learned importance.
IMV-LSTM in these two group of experiments shares the same network size.
In Table
[Table]
we observe that by feeding variables chosen by Pearson correlation, IMV-Full and IMVTensor both degrade in prediction.
Pearson measures linear correlation.
Selecting variables based on it neglects the potential non-linear correlation in data and does not necessarily collect the proper variables for neural networks to reach desirable prediction performance.
In IMV-LSTM, importance values are derived from the variable-wise temporal attention and variable attention in the loss function.
Such attentions are jointly learned to minimize the loss function (i
[Table]
e. to optimize the prediction performance) and thus the variables chosen based on these learned importance values give rise to relatively retained prediction performance of IMV-LSTM.
[Table]
6. D ISCUSSION
In this part, we summarize the insights from the experiments.
Prediction performance For multi-variable data, capturing individual variable’s behaviors and their interaction is the key for both prediction and interpretation.
Conventional hidden states in standard LSTMs consume the data from all input variables at each step, while our IMV-LSTM family decomposes the hidden states by deﬁning variable data ﬂows for each hidden state element.
In the experiments, IMV-Full and IMV-Tensor outperform baselines using the traditional hidden states.
Multi-variable data potentially carries different dynamics.
Conventional hidden states mix the data of all input variables, thereby failing to explicitly capture individual dynamics.
In the multi-variable setting, these opaque hidden states are a burden to both prediction and interpretation.
On the contrary, IMV-Tensor models individual variables and then uses mixture attention to capture the variable interaction by variable-wise hidden states.
It achieves superior prediction performance and enables the interpretability on both temporal and variable levels.
Effectiveness of importance values For LSTM networks on multi-variable data, importance values inherently learned by the network are more suitable for retaining useful variables for predicting.
By choosing the variables based on the learned importance value, IMV-LSTM family mostly retains the prediction performance and presents lower prediction errors on two datasets.
The importance value in IMV-LSTM is derived during the training and therefore it is able to effectively identify the variables used by IMV-LSTM to minimize the loss function, i.e. maximize the prediction accuracy.
Pearson correlation variable selection leads to the quality loss in prediction performance, i.e. higher errors.
Pearson correlation measures the linear correlation and pre-selecting variables based on it neglects the potential non-linear correlation in data indispensable for LSTMs to capture.