Deep Temporal Sigmoid Belief Networks for Sequence Modeling
Zhe Gan, Chunyuan Li, Ricardo Henao, David Carlson, Lawrence Carin
Introduction
Considerable research has been devoted to developing probabilistic models for high-dimensional time-series data, such as video and music sequences, motion capture data, and text streams. Among them, Hidden Markov Models (HMMs) and Linear Dynamical Systems (LDS) have been widely studied, but they may be limited in the type of dynamical structures they can model. An HMM is a mixture model, which relies on a single multinomial variable to represent the history of a time-series. To represent bits of information about the history, an HMM could require distinct states. On the other hand, real-world sequential data often contain complex non-linear temporal dependencies, while a LDS can only model simple linear dynamics.
Another class of time-series models, which are potentially better suited to model complex probability distributions over high-dimensional sequences, relies on the use of Recurrent Neural Networks (RNNs) , and variants of a well-known undirected graphical model called the Restricted Boltzmann Machine (RBM) . One such variant is the Temporal Restricted Boltzmann Machine (TRBM) , which consists of a sequence of RBMs, where the state of one or more previous RBMs determine the biases of the RBM in the current time step. Learning and inference in the TRBM is non-trivial. The approximate procedure used in is heuristic and not derived from a principled statistical formalism.
Recently, deep directed generative models are becoming popular. A directed graphical model that is closely related to the RBM is the Sigmoid Belief Network (SBN) . In the work presented here, we introduce the Temporal Sigmoid Belief Network (TSBN), which can be viewed as a temporal stack of SBNs, where each SBN has a contextual hidden state that is inherited from the previous SBNs and is used to adjust its hidden-units bias. Based on this, we further develop a deep dynamic generative model by constructing a hierarchy of TSBNs. This can be considered as a deep SBN with temporal feedback loops on each layer. Both stochastic and deterministic hidden layers are considered.
Compared with previous work, our model: (i) can be viewed as a generalization of an HMM with distributed hidden state representations, and with a deep architecture; (ii) can be seen as a generalization of a LDS with complex non-linear dynamics; (iii) can be considered as a probabilistic construction of the traditionally deterministic RNN; (iv) is closely related to the TRBM, but it has a fully generative process, where data are readily generated from the model using ancestral sampling; (v) can be utilized to model different kinds of data, e.g., binary, real-valued and counts.
The “explaining away” effect described in makes inference slow, if one uses traditional inference methods. Another important contribution we present here is to develop fast and scalable learning and inference algorithms, by introducing a recognition model , that learns an inverse mapping from observations to hidden variables, based on a loss function derived from a variational principle. By utilizing the recognition model and variance-reduction techniques from , we achieve fast inference both at training and testing time.
Model Formulation
where , , , , , and the logistic function, . The parameters , and characterize all data, and the hidden variables, , are specific to particular visible data, .
The SBN is closely related to the RBM , which is a Markov random field with the same bipartite structure as the SBN. The RBM defines a distribution over a binary vector that is proportional to the exponential of its energy, defined as . The conditional distributions, and , in the RBM are factorial, which makes inference fast, while parameter estimation usually relies on an approximation technique known as Contrastive Divergence (CD) .
The energy function of an SBN may be written as . SBNs explicitly manifest the generative process to obtain data, in which the hidden layer provides a directed “explanation” for patterns generated in the visible layer. However, the “explaining away” effect described in makes inference inefficient, the latter can be alleviated by exploiting recent advances in variational inference methods .
2 Temporal Sigmoid Belief Networks
The proposed Temporal Sigmoid Belief Network (TSBN) model is a sequence of SBNs arranged in such way that at any given time step, the SBN’s biases depend on the state of the SBNs in the previous time steps. Specifically, assume we have a length- binary visible sequence, the th time step of which is denoted . The TSBN describes the joint probability as
where , , and each represents the hidden state corresponding to time step . For , each conditional distribution in (2) is expressed as
By setting and to be zero matrices, the TSBN can be viewed as a Hidden Markov Model with an exponentially large state space, that has a compact parameterization of the transition and the emission probabilities. Specifically, each hidden state in the HMM is represented as a one-hot length- vector, while in the TSBN, the hidden states can be any length- binary vector. We note that the transition matrix is highly structured, since the number of parameters is only quadratic w.r.t. . Compared with the TRBM , our TSBN is fully directed, which allows for fast sampling of “fantasy” data from the inferred model.
3 TSBN Variants
The model above can be readily extended to model real-valued sequence data, by substituting (14) with , where
and and are elements of and , respectively. and are of the same size of and , respectively. Compared with the Gaussian TRBM , in which is fixed to 1, our formalism uses a diagonal matrix to parameterize the variance structure of .
Modeling count data
We also introduce an approach for modeling time-series data with count observations, by replacing (14) with , where
This formulation is related to the Replicated Softmax Model (RSM) described in , however, our approach uses a directed connection from the binary hidden variables to the visible counts, while also learning the dynamics in the count sequences.
Furthermore, rather than assuming that and only depend on and , in the experiments, we also allow for connections from the past time steps of the hidden and visible states, to the current states, and . A sliding window is then used to go through the sequence to obtain frames at each time. We refer to as the order of the model.
4 Deep Architecture for Sequence Modeling with TSBNs
Scalable Learning and Inference
Computation of the exact posterior over the hidden variables in (2) is intractable. Approximate Bayesian inference, such as Gibbs sampling or mean-field variational Bayes (VB) inference, can be implemented . However, Gibbs sampling is very inefficient, due to the fact that the conditional posterior distribution of the hidden variables does not factorize. The mean-field VB indeed provides a fully factored variational posterior, but this technique increases the gap between the bound being optimized and the true log-likelihood, potentially resulting in a poor fit to the data. To allow for tractable and scalable inference and parameter learning, without loss of the flexibility of the variational posterior, we apply the Neural Variational Inference and Learning (NVIL) algorithm described in .
We are interested in training the TSBN model, , described in (2), with parameters . Given an observation , we introduce a fixed-form distribution, , with parameters , that approximates the true posterior distribution, . We then follow the variational principle to derive a lower bound on the marginal log-likelihood, expressed asThis lower bound is equivalent to the marginal log-likelihood if = .
We construct the approximate posterior as a recognition model. By using this, we avoid the need to compute variational parameters per data point; instead we compute a set of parameters used for all . In order to achieve fast inference, the recognition model is expressed as
and each conditional distribution is specified as
The recognition model defined in (9) has the same form as in the approximate inference used for the TRBM . Exact inference for our model consists of a forward and backward pass through the entire sequence, that requires the traversing of each possible hidden state. Our feedforward approximation allows the inference procedure to be fast and implemented in an online fashion.
2 Parameter Learning
To optimize (7), we utilize Monte Carlo methods to approximate expectations and stochastic gradient descent (SGD) for parameter optimization. The gradients can be expressed as
Specifically, in the TSBN model, if we define and , the gradients for and can be calculated as
Inspecting (11), we see that we are using as the learning signal for the recognition parameters . The expectation of this learning signal is exactly the lower bound (7), which is easy to evaluate. However, this tractability makes the estimated gradients of the recognition parameters very noisy. In order to make the algorithm practical, we employ the variance reduction techniques proposed in , namely: (i) centering the learning signal, by subtracting the data-independent baseline and the data-dependent baseline; (ii) variance normalization, by dividing the centered learning signal by a running estimate of its standard deviation. The data-dependent baseline is implemented using a neural network. Additionally, RMSprop , a form of SGD where the gradients are adaptively rescaled by a running average of their recent magnitude, were found in practice to be important for fast convergence; thus utilized throughout all the experiments. The outline of the NVIL algorithm is provided in the Supplementary Section A.
3 Extension to deep models
The recognition model corresponding to the deep TSBN is shown in Figure 4(d). Two kinds of deep architectures are discussed in Section 2.4. We illustrate the difference of their learning algorithms in two respects: (i) the calculation of the lower bound; and (ii) the calculation of the gradients.
The top hidden layer is stochastic. If the middle hidden layers are also stochastic, the calculation of the lower bound is more involved, compared with the shallow model; however, the gradient evaluation remain simple as in (12). On the other hand, if deterministic middle hidden layers (i.e., recurrent neural networks) are employed, the lower bound objective will stay the same as a shallow model, since the only stochasticity in the generative process lies in the top layer; however, the gradients have to be calculated recursively through the back-propagation through time algorithm . All details are provided in the Supplementary Section C.
Related Work
The RBM has been widely used as building block to learn the sequential dependencies in time-series data, e.g., the conditional-RBM-related models , and the temporal RBM . To make exact inference possible, the recurrent temporal RBM was also proposed , and further extended to learn the dependency structure within observations .
In the work reported here, we focus on modeling sequences based on the SBN , which recently has been shown to have the potential to build deep generative models . Our work serves as another extension of the SBN that can be utilized to model time-series data. Similar ideas have also been considered in and . However, in , the authors focus on grammar learning, and use a feed-forward approximation of the mean-field VB to carry out the inference; while in , the wake-sleep algorithm was developed. We apply the model in a different scenario, and develop a fast and scalable inference algorithm, based on the idea of training a recognition model by leveraging the stochastic gradient of the variational bound.
There exist two main methods for the training of recognition models. The first one, termed Stochastic Gradient Variational Bayes (SGVB), is based on a reparameterization trick , which can be only employed in models with continuous latent variables, e.g., the variational auto-encoder and all the recent recurrent extensions of it . The second one, called Neural Variational Inference and Learning (NVIL), is based on the log-derivative trick , which is more general and can also be applicable to models with discrete random variables. The NVIL algorithm has been previously applied to the training of SBN in . Our approach serves as a new application of this algorithm for a SBN-based time-series model.
Experiments
We present experimental results on four publicly available datasets: the bouncing balls , polyphonic music , motion capture and state-of-the-Union . To assess the performance of the TSBN model, we show sequences generated from the model, and report the average log-probability that the model assigns to a test sequence, and the average squared one-step-ahead prediction error per frame. Code is available at https://github.com/zhegan27/TSBN_code_NIPS2015.
The TSBN model with and is denoted Hidden Markov SBN (HMSBN), the deep TSBN with stochastic hidden layer is denoted DTSBN-S, and the deep TSBN with deterministic hidden layer is denoted DTSBN-D.
Model parameters were initialized by sampling randomly from , except for the bias parameters, that were initialized as 0. The TSBN model is trained using a variant of RMSprop , with momentum of 0.9, and a constant learning rate of . The decay over the root mean squared gradients is set to 0.95. The maximum number of iterations we use is . The gradient estimates were computed using a single sample from the recognition model. The only regularization we used was a weight decay of . The data-dependent baseline was implemented by using a neural network with a single hidden layer with 100 tanh units.
For the prediction of given , we (i) first obtain a sample from ; (ii) calculate the conditional posterior of the current hidden state ; (iii) make a prediction for using . On the other hand, synthesizing samples is conceptually simper. Sequences can be readily generated from the model using ancestral sampling.
We conducted the first experiment on synthetic videos of 3 bouncing balls, where pixels are binary valued. We followed the procedure in , and generated 4000 videos for training, and another 200 videos for testing. Each video is of length 100 and of resolution .
The dictionaries learned using the HMSBN are shown in Figure 2 (Left). Compared with previous work , our learned bases are more spatially localized. In Table C.2, we compare the average squared prediction error per frame over the 200 test videos, with recurrent temporal RBM (RTRBM) and structured RTRBM (SRTRBM). As can be seen, our approach achieves better performance compared with the baselines in the literature. Furthermore, we observe that a high-order TSBN reduces the prediction error significantly, compared with an order-one TSBN. This is due to the fact that by using a high-order TSBN, more information about the past is conveyed. We also examine the advantage of employing deep models. Using stochastic, or deterministic hidden layer improves performances. More results, including log-likelihoods, are provided in Supplementary Section D.
Another popular motion capture dataset is the MIT datasetQuantitative results on the MIT dataset are provided in Supplementary Section D.. To further demonstrate the directed, generative nature of our model, we give our trained HMSBN model different initializations, and show generated, synthetic data and the transitions between different motion styles in Figure 3. These generated data are readily produced from the model and demonstrate realistic behavior. The smooth trajectories are walking movements, while the vibrating ones are running. Corresponding video files (AVI) are provided as mocap 1, 2 and 3 in the Supplementary Material.
3 Polyphonic music dataset
The third experiment is based on four different polyphonic music sequences of piano , i.e., Piano-midi.de (Piano), Nottingham (Nott), MuseData (Muse) and JSB chorales (JSB). Each of these datasets are represented as a collection of 88-dimensional binary sequences, that span the whole range of piano from A0 to C8.
The samples generated from the trained HMSBN model are shown in Figure 2 (Middle). As can be seen, different styles of polyphonic music are synthesized. The corresponding MIDI files are provided as music 1 and 2 in the Supplementary Material. Our model has the ability to learn basic harmony rules and local temporal coherence. However, long-term structure and musical melody remain elusive. The variational lower bound, along with the estimated log-likelihood in , are presented in Table 5.4. The TSBN we implemented is of size and order . Empirically, adding layers did not improve performance on this dataset, hence no such results are reported. The results of RNN-NADE and RTRBM were obtained by only runs of the annealed importance sampling, which has the potential to overestimate the true log-likelihood. Our variational lower bound provides a more conservative estimate. Though, our performance is still better than that of RNN.
4 State of the Union dataset
The State of the Union (STU) dataset contains the transcripts of US State of the Union addresses, from 1790 to 2014. Two tasks are considered, i.e., prediction and dynamic topic modeling.
The prediction task is concerned with estimating the held-out words. We employ the setup in . After removing stop words and terms that occur fewer than 7 times in one document or less than 20 times overall, there are 2375 unique words. The entire data of the last year is held-out. For the documents in the previous years, we randomly partition the words of each document into 80%/20% split. The model is trained on the 80% portion, and the remaining 20% held-out words are used to test the prediction at each year. The words in both held-out sets are ranked according to the probability estimated from (6).
To evaluate the prediction performance, we calculate the precision top-as in , which is given by the fraction of the top- words, predicted by the model, that matches the true ranking of the word counts. is used. Two recent works are compared, GP-DPFA and DRFM . The results are summarized in Table 5.4. Our model is of order 1. The column MP denotes the mean precision over all the years that appear in the training set. The column PP denotes the predictive precision for the final year. Our model achieves significant improvements in both scenarios.
Dynamic Topic Modeling
The setup described in is employed, and the number of topics is . To understand the temporal dynamic per topic, three topics are selected and the normalized probability that a topic appears at each year are shown in Figure 2 (Right). Their associated top 6 words per topic are shown in Table LABEL:table:stu_topics. The learned trajectory exhibits different temporal patterns across the topics. Clearly, we can identify jumps associated with some key historical events. For instance, for Topic 29, we observe a positive jump in 1986 related to military and paramilitary activities in and against Nicaragua brought by the U.S. Topic 30 is related with war, where the War of 1812, World War II and Iraq War all spike up in their corresponding years. In Topic 130, we observe consistent positive jumps from 1890 to 1920, when the American revolution was taking place. Three other interesting topics are also shown in Table LABEL:table:stu_topics. Topic 64 appears to be related to education, Topic 70 is about Iraq, and Topic 74 is Axis and World War II. We note that the words for these topics are explicitly related to these matters.
We have presented the Deep Temporal Sigmoid Belief Networks, an extension of SBN, that models the temporal dependencies in high-dimensional sequences. To allow for scalable inference and learning, an efficient variational optimization algorithm is developed. Experimental results on several datasets show that the proposed approach obtains superior predictive performance, and synthesizes interesting sequences.
In this work, we have investigated the modeling of different types of data individually. One interesting future work is to combine them into a unified framework for dynamic multi-modality learning. Furthermore, we can use high-order optimization methods to speed up inference .
This research was supported in part by ARO, DARPA, DOE, NGA and ONR.
References
Appendix A Outline of the NVIL algorithm
The outline of the NVIL algorithm for computing gradients are shown below (reproduced from ). represents the data-dependent baseline, and throughout the experiments.
The gradients for the model parameters are expressed as
The gradients for the recognition parameters are expressed as
When modeling real-valued data, we substitute (14) with , where
All the gradient calculation remains the same as (21)-(24), except the following.
B.2 Modeling Count Data
We also introduce an approach for modeling time-series data with count observations, by replacing (14) with , where
The recognition model still remains the same as in (15). The now is expressed as
All the gradient calculations remain the same as (21)-(24), except the following
where we have defined .
Appendix C Learning and Inference Details on Deep TSBN
For the ease of notation, we consider a two-hidden-layer deep TSBN here, which can be readily extended to a deep model with any depth. For , we consider the observation as . The top hidden layer is denoted as .
Denote the first stochastic hidden layer as . The generative model is expressed as
All the gradients can be calculated readily as in (21)-(24).
C.2 Using deterministic hidden layer
The corresponding recognition model is expressed as
The gradients w.r.t. and can be calculated easily. In order to calculate the gradients w.r.t. and , we need to obtain and , which can be calculated recursively via the back-propagation through time algorithm. Specifically, and we have defined
We observe that can be computed recursively using
where . Using the chain rule, we have
can be calculated similarly.
The generated, synthetic motion capture data, and polyphonic music data can be downloaded from https://drive.google.com/drive/u/0/folders/0B1HR6m3IZSO_SWt0aS1oYmlneDQ.
D.2 Bouncing balls dataset
Additional experimental results are shown in Table C.2. AR represents an auto-regressive Markov model without latent variables.
D.3 MIT motion capture dataset
We randomly select 10% of the dataset as the test set. Quantitative results are shown in Table D.3.