The hidden unit logistic model for Multivariate Time Series Classification
We present a new model for time series classification, called the hidden-unit logistic model, that uses binary stochastic hidden units to model latent structure in the data. The hidden units are connected in a chain structure that models temporal dependencies in the data. Compared to the prior models for time series classification such as the hidden conditional random field, our model can model very complex decision boundaries because the number of latent states grows exponentially with the number of hidden units. We demonstrate the strong performance of our model in experiments on a variety of (computer vision) tasks, including handwritten character recognition, speech recognition, facial expression, and action recognition. We also present a state-of-the-art system for facial action unit detection based on the hidden-unit logistic model.READ FULL TEXT VIEW PDF
The hidden unit logistic model for Multivariate Time Series Classification
Time series classification is the problem of assigning a single label to a sequence of observations (i.e., to a time series). Time series classification has a wide range of applications in computer vision. A state-of-the-art model for time series classification problem is the hidden-state conditional random field (HCRF) , which models latent structure in the data using a chain of -nomial latent variables. The HCRF has been successfully used in, amongst others, gesture recognition , object recognition , and action recognition . An important limitation of the HCRF is that the number of model parameters grows linearly with the number of latent states in the model. This implies that the training of complex models with a large number of latent states is very prone to overfitting, whilst models with smaller numbers of parameters may be too simple to represent a good classification function. In this paper, we propose to circumvent this problem of the HCRF by replacing each of the -nomial latent variables by a collection of binary stochastic hidden units. To keep inference tractable, the hidden-unit chains are conditionally independent given the time series and the label. Similar ideas have been explored before in discriminative RBMs  for standard classification problems and in hidden-unit CRFs  for sequence labeling. The binary stochastic hidden units allow the resulting model, which we call the hidden-unit logistic model (HULM), to represent latent states using only
parameters. This substantially reduces the amount of data needed to successfully train models without overfitting, whilst maintaining the ability to learn complex models with exponentially many latent states. Exact inference in our proposed model is tractable, which makes parameter learning via (stochastic) gradient descent very efficient. We show the merits of our hidden-unit logistic model in experiments on computer-vision tasks ranging from online character recognition to activity recognition and facial expression analysis. Moreover, we present a system for facial action unit detection that, with the help of the hidden-unit logistic model, achieves state-of-the-art performance on a commonly used benchmark for facial analysis.
The remainder of this paper is organized as follows. Section 2 reviews prior work on time series classification. Section 3 introduces our hidden-unit logistic model and describes how inference and learning can be performed in the model. In Section 4, we present the results of experiments comparing the performance of our model with that of state-of-the-art time series classification models on a range of classification tasks. In Section 5, we present a new state-of-the-art system for facial action unit detection based on the hidden-unit logistic model. Section 6 concludes the paper.
There is a substantial amount of prior work on time series classification. Much of this work is based on the use of (kernels based on) dynamic time warping (e.g., 
) or on hidden Markov models (HMMs). The HMM is a generative model that models the time series data in a chain of latent -nomial features. Class-conditional HMMs are commonly combined with class priors via Bayes’ rule to obtain a time series classification models. Alternatively, HMMs are also frequently used as the base model for Fisher kernel 
, which constructs a time series representation that consists of the gradient a particular time series induces in the parameters of the HMM; the resulting representations can be used on standard classifiers such as SVMs. Some recent work has also tried to learn the parameters of the HMM in such a way as to learn Fisher kernel representations that are well-suited for nearest-neighbor classification
. HMMs have also been used as the base model for probability product kernels, which fit a single HMM on each time series and define the similarity between two time series as the inner product between the corresponding HMM distributions. A potential drawback of these approaches is that they perform classification based on (rather simple) generative models of the data that may not be well suited for the discriminative task at hand. By contrast, we opt for a discriminative model that does not waste model capacity on features that are irrelevant for classification.
In contrast to HMMs, conditional random fields (CRFs; 
) are discriminative models that are commonly used for sequence labeling of time series using so-called linear-chain CRFs. Whilst standard linear-chain CRFs achieve strong performance on very high-dimensional data (e.g., in natural language processing), the linear nature of most CRF models limits their ability to learn complex decision boundaries. Several sequence labeling models have been proposed to address this limitation, amongst which are latent-dynamic CRFs, conditional neural fields , and hidden-unit CRFs . These models introduce stochastic or deterministic hidden units that model latent structure in the data, allowing these models to represent nonlinear decision boundaries. As these prior models were designed for sequence labeling (assigning a label to each frame in the time series), they cannot readily be used for time series classification (assigning a single label to the entire time series). Our hidden-unit logistic model may be viewed as an adaptation of sequence labeling models with hidden units to the time series classification problem. As such, it is closely related to the hidden CRF model . The key difference between our hidden-unit logistic model and the hidden CRF is that our model uses a collection of binary stochastic hidden units instead of a single -nomial hidden unit, which allows our model to represent exponentially more states with the same number of parameters.
An alternative approach to expanding the number of hidden states of the HCRF is the infinite HCRF (iHCRF), which employs a Dirichlet process to determine the number of hidden states. Inference in the iHCRF can be performed via collapsed Gibbs sampling  or variational inference . Whilst theoretically facilitating infinitely many states, the modeling power of the iHCRF is, however, limited to the number of “represented” hidden states. Unlike our model, the number of parameters in the iHCRF thus still grows linearly with the number of hidden states.
The hidden-unit logistic model is a probabilistic graphical model that receives a time series as input, and is trained to produce a single output label for this time series. Like the hidden-state CRF, the model contains a chain of hidden units that aim to model latent temporal features in the data, and that form the basis for the final classification decision. The key difference with the HCRF is that the latent features are model in binary stochastic hidden units, much like in a (discriminative) RBM. These hidden units can model very rich latent structure in the data: one may think about them as carving up the data space into small clusters, all of which may be associated with particular clusters. The parameters of the temporal chains that connect the hidden units may be used to differentiate between features that are “constant” (i.e., that are likely to be presented for prolonged lengths of time) or that are “volatile” (i.e., that tend to rapidly appear and disappear). Because the hidden-unit chains are conditionally independent given the time series and the label, they can be integrated out analytically when performing inference or learning.
Suppose we are given a time series of length in which the observation at the -th time step is denoted by
. Conditioned on this time series, the hidden-unit logistic model outputs a distribution over vectorsthat represent the predicted label using a -of-
encoding scheme (i.e., a one-hot encoding):and .
Denoting the stochastic hidden units at time step by , the hidden-unit logistic model defines the conditional distribution over label vectors using a Gibbs distribution in which all hidden units are integrated out:
Herein, denotes a partition function that normalizes the distribution, and is given by:
The energy function of the hidden-unit logistic model is defined as:
The graphical model of the hidden-unit logistic model is shown in Figure 1.
The main inferential problem given an observation is the evaluation of predictive distribution . The key difficulty in computing this predictive distribution is the sum over all hidden unit states:
The chain structure of the hidden-unit logistic model allows us to employ a standard forward-backward algorithm that can compute in computational time linear in .
Specifically, defining potential functions that contain all terms that involve time and hidden unit :
ignoring bias terms, and introducing virtual hidden units at time , we can rewrite as:
In the above derivation, it should be noted that the product over hidden units can be pulled outside the sum over all states because the hidden-unit chains are conditionally independent given the data and the label . Subsequently, the product over time can be pulled outside the sum because of the (first-order) Markovian chain structure of the temporal connections between hidden units.
In particular, the required quantities can be evaluated using the forward-backward algorithm, in which we define the forward messages with as:
and the backward messages as:
These messages can be calculated recursively as follows:
The value of can readily be computed from the resulting forward messages or backward messages:
To complete the evaluation of the predictive distribution, we compute the partition function of the predictive distribution by summing over all possible labels: . Indeed, inference in the hidden-unit logistic model is linear in both the length of the time series and in the number of hidden units .
Another inferential problem that needs to be solved during parameter learning is the evaluation of the marginal distribution over a chain edge:
Using a similar derivation, it can be shown that this quantity can also be computed from the forward and backward messages:
Given a training set containing pairs of time series and their associated label. We learn the parameters of the hidden-unit logistic model by maximizing the conditional log-likelihood of the training data with respect to the parameters:
We augment the conditional log-likelihood with L2-regularization terms on the parameters , , and . As the objective function is not amenable to closed-form optimization (in fact, it is not even a convex function), we perform optimization using stochastic gradient descent on the negative conditional log-likelihood. The gradient of the conditional log-likelihood with respect to a parameter is given by:
where we omitted the sum over training examples for brevity. The required expectations can readily be computed using the inference algorithm described in the previous subsection.
For example, defining for notational simplicity, the first expectation can be computed as follows:
The second expectation is simply an average of these expectations over all possible labels .
To evaluate the performance of the hidden-unit logistic model, we conducted classification experiments on five different problems involving time series features: (1) an online handwritten character data set (OHC) ; (2) a data set of Arabic spoken digits (ASD) ; (3) the Cohn-Kanade extended facial expression data set (CK+) ; (4) the MSR Action 3D data set (Action) ; and (5) the MSR Daily Activity 3D data set (Activity) . The five data sets are introduced in 4.1, the experimental setup is presented in 4.2, and the results of the experiments are in 4.3.
The online handwritten character dataset  is a pen-trajectory time series data set that consists of three dimensions at each time step, viz., the pen movement in the -direction and -direction, and the pen pressure. The data set contains 2858 time series with an average length of 120 frames. Each time series corresponds to a single handwritten character that has one of 20 labels. We pre-process the data by windowing the features of 10 frames into a single feature vector with dimensions.
The Arabic spoken digit dataset contains 8800 utterances , which were collected by asking 88 Arabic native speakers to utter all 10 digits ten times. Each time series consists of 13-dimensional MFCCs which were sampled at 11,025Hz, 16-bits using a Hamming window. We enrich the features by windowing 3 frames into 1 frames resulting in the dimensions for each frame of the features while keeping the same length of time series.
The Cohn-Kanade extended facial expression data set  contains 593 image sequences (videos) from 123 subjects. Each video shows a single facial expression. The videos have an average length of 18 frames. A subset of 327 of the videos, which have validated label corresponding to one of seven emotions (anger, contempt, disgust, fear, happiness, sadness, and surprise), are used in our experiments. We adopt the publicly available shape features used in  as the feature representation for our experiments. These features represent each frame by the variation of 68 feature point locations () with respect to the first frame , which leads to 136-dimensional feature representation for each frame in the video.
The MSR Action 3D data set  consists of RGB-D videos of people performing certain actions. The data set contains 567 videos with an average length of 41 frames. Each video should be classified into one of 20 actions such as “high arm wave”, “horizontal arm wave”, and “hammer”. We use the real-time skeleton tracking algorithm of  to extract the 3D joint positions from the depth sequences. We use the 3D joint position features (pairwise relative positions) proposed in  as the feature representation for the frames in the videos. Since we track a total of 20 joints, the dimensionality of the resulting feature representation is , where is the number of pairwise distances between joints and 3 is dimensionality of the coordinate vectors.
The MSR Daily Activity 3D data set  contains RGB-D videos of people performing daily activities. The data set also contains 3D skeletal joint positions, which are extracted using the Kinect SDK. The videos need to be classified into one of 16 activity types, which include “drinking”, “eating”, “reading book”, etc. Each activity is performed by 10 subjects in two different poses (namely, while sitting on a sofa and while standing), which leads to a total of 320 videos. The videos have an average length of 193 frames. To represent each frame, we extract -dimensional 3D joint position features.
In our experiments, the model parameters. The initial-state parameter , final-state parameter and the bias parameters were initialized to 0. Training of our model is performed using a standard stochastic gradient descent procedure; the learning rate is decayed during training. We set the number of hidden units to . The L2-regularization parameter was tuned by minimizing the error on a small validation set.
We compare the performance of our hidden-unit logistic model with that of three other time series classification models: (1) the naive logistic model shown in Figure 2, (2) the popular HCRF model , and (3) Fisher kernel learning model . Details of these models are given below.
The naive logistic model is a linear logistic model that shares parameters between all time steps, and makes a prediction by summing (or equivalently, averaging) the inner products between the model weights and feature vectors over time before applying the softmax function. Specifically, the naive logistic model defined the following conditional distribution over the label given the time series data :
where the energy function is defined as
The corresponding graphical model is shown in Figure 2. We include the naive logistic model in our experiments to investigate the effect of adding hidden units to models that average energy contributions over time.
The hidden-state CRF’s graphical model is very similar to that of the hidden-unit logistic model . The key difference between the two models is in the way the hidden units are defined: whereas the hidden-unit logistic model uses a substantial number of binary stochastic hidden units to represent the latent state, the HCRF uses a single multinomial unit (much like a hidden Markov model). We performed experiments using the hidden CRF implementation of , which learns the parameters of the model using L-BFGS. Following , we trained HCRFs with 10 latent states on all data sets. (We found it was computationally infeasible to train HCRFs with more than 10 latent states.) We tune the L2-regularization parameter of the HCRF on a small validation set.
In addition to comparing with HCRFs, we compare the performance of our model with that of the recently proposed Fisher kernel learning (FKL) model . We selected the FKL model for our experiments because  reports strong performance on a range of time series classification problems. We trained FKL models based on hidden Markov models with hidden states (the number of hidden states was set identical to that of the hidden CRF). Subsequently, we computed the Fisher kernel representation and trained a linear SVM on the resulting features to obtain the final classifier. The slack parameter of the SVM is tuned on a small validation set.
We perform two sets of experiments with the hidden-unit logistic model: (1) a set of experiments in which we evaluate the performance of the model (and of the hidden CRF) as a function of the number of hidden units and (2) a set of experiments in which we compare the performance of all models on all data sets. The two sets of experiments are described separately below.
We first conduct experiments on the ASD data set to investigate the performance of the hidden-unit logistic model as a function of the number of hidden units. The results of these experiments are shown in Figure 3(a). The results presented in the figure show that the error initially decreases when the number of hidden unit increases, because adding hidden units adds complexity to the model that allows it to better fit the data. However, as the hidden unit number increases further, the model starts to overfit on the training data despite the use of L2-regularization.
We performed a similar experiment on the CK+ facial expression data set, in which we also performed comparisons with the hidden CRF for a range of values for the number of hidden states. Figure 3(b) presents the results of these experiments. On the CK+ data set, there are no large fluctuations in the errors of the HULM as the hidden parameter number increases. The figure also shows that the hidden-unit logistic model outperforms the hidden CRF irrespective of the number of hidden units. For instance, a hidden-unit logistic model with 10 hidden units outperforms even a hidden CRF with 100 hidden parameters. This result illustrates the potential merits of using models in which the number of latent states grows exponentially with the number of parameters.
In a second set of experiments, we compare the performance of the hidden-unit logistic model with that of the naive logistic model, Fisher kernel learning, and the hidden CRF on all five data sets. In our experiments, the number of hidden units in the hidden-unit logistic model was set to 100; following , the hidden CRF used 10 latent states. The results of our experiments are presented in Table 1, and are discussed for each data set separately below.
Following the experimental setup in , we measure the generalization error of all our models on the online handwritten character dataset using 10-fold cross validation. The average generalization error of each model is shown in Table 1. Whilst the naive logistic model performs very poorly on this data set, all three other methods achieve very low error rates. The best performance is obtained FKL, but the differences between the models are very small on this data set, presumably, due to a ceiling effect.
Following , the error rates for the Arabic spoken digits data set in Table 1 were measured using a fixed training/test division: of samples are used for training and left of samples compose test set. The best performance on this data set is obtained by the hidden CRF model (), whilst our model has a slightly higher error of , which in turn is better than the performance of FKL. It should be noted that the performance of the hidden CRF and the hidden-unit logistic model are better than the error rate of reported in  (on the same training/test division).
Table 1 presents generalization errors measured using 10-fold cross-validation. Folds are constructed in such a way that all videos by the same subject are in the same fold (the subjects appearing in test videos were not present in the training set). On the CK+ data set, the hidden-unit logistic model substantially outperforms the hidden CRF model, obtaining an error of . Somewhat surprisingly, the naive logistic model also outperforms the hidden CRF model with an error of . A possible explanation for this result is that the classifying these data successfully does not require exploitation of temporal structure: many of the expressions can also be recognized well from a single frame. As a result, the naive logistic model may perform well even though it simply averages over time. This result also suggests that the hidden CRF model may perform poorly on high-dimensional data (the CK+ data is 136-dimensional) despite performing well on low-dimensional data such as the handwritten character data set (3-dimensional) and the Arabic spoken data set (13-dimensional).
To measure the generalization error of the time series classification models on the MSR Action 3D dataset, we followed the experimental setup of : we used all videos of the five subjects for training, and used the videos of the remaining five subjects for testing. Table 1 presents the average generalization error on the videos of the five test subjects. The four models perform quite similarly, although the hidden CRF and the hidden-unit logistic model do appear to outperform the other two models somewhat.
On the MSR Daily Activity data set, we use the same experimental setup as on the action data set: five subjects are used for training and five for testing. The results in Table 1 show that the hidden-unit logistic model substantially outperforms the hidden CRF on this challenging data set (but FKL performs slightly better).
In terms of the average error rate and average rank over all data sets, the hidden-unit logistic model performs very strongly. Indeed, it substantially outperforms the hidden CRF model, which illustrates that using a collection of (conditionally independent) hidden units may be a more effective way to represent latent states than a single multinomial unit. FKL also performs quite well in our experiments, although its performance is slightly worse than that of the hidden-unit logistic model. However, it should be noted here that FKL scales poorly to large data sets: its computational complexity is quadratic in the number of time series, which limits its applicability to relatively small data sets (with fewer than, say, time series). By contrast, the training of hidden-unit logistic models scales linearly in the number of time series and, moreover, can be performed using stochastic gradient descent.
In this section, we present a system for facial action unit (AU) detection that is based on the hidden-unit logistic model. We evaluate our system on the Cohn-Kanade extended facial expression database (CK+) 
, evaluating its ability to detect 10 prominent facial action units: namely, AU1, AU2, AU4, AU5, AU6, AU7, AU12, AU15, AU17, and AU25. We compare the performance of our facial action unit detection system with that of state-of-the-art systems for this problem. Before describing the results of these experiments, we first describe the feature extraction of our AU detection system and the setup of our experiments.
We extract two types of features from the video frames in the CK+ data set: (1) shape features and (2) appearance features. Our features are identical to the features used by the system described in ; the features are publicly available online. For completeness, we briefly describe both types of features below.
The shape features represent each frame by the vertical/horizontal displacements of facial landmarks with respect to the first frame. To this end, automatically detected/tracked 68 landmarks are used to form 136-dimensional time series. All landmark displacements are normalized by removing rigid transformations (translation, rotation, and scale).
The appearance features
are based on grayscale intensity values. To capture the change in facial appearance, face images are warped onto a base shape, where feature points are in the same location for each face. After this shape normalization procedure, the grayscale intensity values of the warped faces can be readily compared. The final appearance features are extracted by subtracting the warped textures from the warped texture in the first frame. The dimensionality of the appearance feature vectors is reduced using principal components analysis as to retainof the variance in the data. This leads to 439-dimensional appearance feature vectors, which are combined with the shape features to form the final feature representation for the video frames. For further details on the feature extraction, we refer to .
To gauge the effectiveness of the hidden-unit logistic model in facial AU detection, we performed experiments on the CK+ database . The database consists of 593 image sequences (videos) from 123 subjects with an average length of 18.1 frames. The videos show expressions from neutral face to peak formation, and include annotations for 30 action units. In our experiments, we only consider the 10 most frequent action units.
Our AU detection system employs 10 separate binary classifiers for detecting action units in the videos. In other words, we train a separate HULM for each facial action unit. An individual model thus distinguishes between the presence and non-presence of the corresponding action unit. We use a 10-fold cross-validation scheme to measure the performance of the resulting AU detection system: we randomly select one test fold containing 10% of the videos, and use remaining nine folds are used to train the system. The folds are constructed such that there is no subject overlap between folds: i.e., subjects appearing in the test data were not present in the training data.
We ran experiments using the HULM on three feature sets: (1) shape features, (2) appearance features, and (3) a concatenation of both feature vectors. We measure the performance of our system using the area under ROC curve (AUC). Table 2 shows the results for HULM, and for the baseline in . The results show that the HULM outperforms the CRF baseline of , with our best model achieving an AUC that is approximately higher than the best result of .
To obtain insight in what features are modeled by the HULM hidden units, we visualized a single column of in Figure 4 for the AU4 and AU25 models that were trained on appearance features. Specifically, we selected the hidden unit with the highest corresponding -value for visualization, as this hidden unit apparently models the most discriminative features. The figure shows that the appearance of the eyebrows is most important in the AU4 model (brow lowerer), whereas the mouth region is most important in the AU25 model (lips part).
In Table 3, we compare the performance of our AU detection system with that of seven other state-of-the-art systems in terms of the more commonly used F1-score. (Please note that the averages are not over the same AUs, and cannot readily be compared.) The results in the table show that our system achieves the best F1 scores for AU1, AU17, and AU25. It performs very strongly on most of the other AUs, illustrating the potential of the hidden-unit logistic model.
In this paper, we presented the hidden-unit logistic model (HULM), a new model for the single-label classification of time series. The model is similar in structure to the popular hidden CRF model, but it employs binary stochastic hidden units instead of multinomial hidden units between the data and label. As a result, the HULM can model exponentially more latent states than a hidden CRF with the same number of parameters. The results of our experiments with HULM on several real-world datasets show that this may result in improved performance on challenging time-series classification tasks. In particular, the HULM performs very competitively on complex computer-vision problems such as facial expression recognition.
In future work, we aim to explore more complex variants of our hidden-unit logistic model. In particular, we intend to study variants of the model in which the simple first-order Markov chains on the hidden units are replaced by more powerful, higher-order temporal connections. Specifically, we intend to implement the higher-order chains via a similar factorization as used in neural autoregressive distribution estimators. The resulting models will likely have longer temporal memory than our current model, which will likely lead to stronger performance on complex time series classification tasks. A second direction for future work we intend to explore is an extension of our model to multi-task learning. Specifically, we will explore multi-task learning scenarios in which sequence labeling and time series classification is performed simultaneously (for instance, simultaneous recognition of short-term actions and long-term activities, or simultaneous optical character recognition and word classification). By performing sequence labeling and time series classification based on the same latent features, the performance on both tasks may be improved because information is shared in the latent features.
This work was supported by EU-FP7 INSIDDE and AAL SALIG++.
Bousmalis, K., Zafeiriou, S., Morency, L.P., Pantic, M.: Infinite hidden conditional random fields for human behavior analysis. IEEE Transactions on Neural Networks and Learning Systems 24(1), 170–177 (2013)
Jebara, T., Kondor, R., Howard, A.: Probability product kernels. Journal of Machine Learning Research 5, 819–844 (2004)
Larochelle, H., Bengio, Y.: Classification using discriminative restricted boltzmann machines. In: ICML. pp. 536–543 (2008)
van der Maaten, L., Welling, M., Saul, L.: Hidden-unit conditional random fields. Int. Conf. on Artificial Intelligence & Statistics pp. 479–488 (2011)