Modeling time series with hidden Markov models
Advanced Machine learning 2017
Nadia Figueroa, Jose Medina and Aude Billard
Modeling time series with hidden Markov models Advanced Machine - - PowerPoint PPT Presentation
Modeling time series with hidden Markov models Advanced Machine learning 2017 Nadia Figueroa, Jose Medina and Aude Billard Time series data Barometric pressure Temperature Data Humidity Time Whats going on here? Modeling time series
Nadia Figueroa, Jose Medina and Aude Billard
Modeling time series with HMMs 2
Time Data
What‘s going on here?
Humidity Barometric pressure Temperature
Modeling time series with HMMs 3
What‘s the problem setting?
Time Data
We don’t care about time …
Time Data
We have several trajectories with identical duration
Explicit time dependency
Hum.
We have unstructured trajectory(ies)!
Consider dependency on the past
Too complex!
Modeling time series with HMMs 4
How to simplify this problem?
Consider dependency on the past
Markov assumption
Rainy Cloudy Sunny
Modeling time series with HMMs 5
Second part (11:15 – 12:00):
https://github.com/epfl-lasa/ML_toolbox First part (10:15 – 11:00):
Time Data
Modeling time series with HMMs 6 Rainy Cloudy Sunny
Modeling time series with HMMs 7 Sunny Cloudy Rainy
Transition matrix
Sunny Cloudy Rainy Sunny Cloudy Rainy
Initial probabilities
Sunny Cloudy Rainy
Modeling time series with HMMs 8
Sunny Sunny Cloudy
Transition matrix
Sunny Cloudy Rainy Sunny Cloudy Rainy
Initial probabilities
Sunny Cloudy Rainy
Modeling time series with HMMs 9
Sunny Sunny Cloudy Periodic Left-to-right Ergodic
Topologies
Modeling time series with HMMs 10 Rainy Cloudy Sunny
Modeling time series with HMMs 11 Sunny Cloudy Rainy
Transition matrix
Sunny Cloudy Rainy Sunny Cloudy Rainy
Initial probabilities
Sunny Cloudy Rainy
Modeling time series with HMMs 12
Transition matrix
Sunny Cloudy Rainy Sunny Cloudy Rainy
Initial probabilities
Sunny Cloudy Rainy Forward variable
Modeling time series with HMMs 13
Transition matrix
Sunny Cloudy Rainy Sunny Cloudy Rainy
Initial probabilities
Sunny Cloudy Rainy Forward variable
Modeling time series with HMMs 14
Transition matrix
Sunny Cloudy Rainy Sunny Cloudy Rainy
Initial probabilities
Sunny Cloudy Rainy Backward variable
Modeling time series with HMMs 15
Baum-Welch algorithm (Expectation-Maximization for HMMs)
Starting from an initial find a such that
probabilities of the states to have produced those observations.
better fit the observations.
Modeling time series with HMMs 16 Probability of being in state i at time k Probability of being in state i at time k and transition to state j
E-step:
Modeling time series with HMMs 17 Probability of being in state i at time k Probability of being in state i at time k and transition to state j
M-step:
Modeling time series with HMMs 18
: dataset; : number of datapoints; : number of free parameters
2ln 2
2ln ln L: maximum likelihood of the model giv X N K L K BIC L K N − + = − + en K parameters Lower BIC implies either fewer explanatory variables, better fit, or both. As the number of datapoints (observations) increase, BIC assigns more weights to simpler models than AIC.
Choosing AIC versus BIC depends on the application: Is the purpose of the analysis to make predictions, or to decide which model best represents reality? AIC may have better predictive ability than BIC, but BIC finds a computationally more efficient solution.
Modeling time series with HMMs 19
State estimation: What is the most probable state/state sequence of the system? Prediction: What are the most probable next
Model selection: What is the most likely model that represents these observations?
Modeling time series with HMMs 20
Speech recognition:
frequency domain
D.B. Paul., Speech Recognition Using Hidden Markov Models, The Lincoln laboratory journal, 1990
Modeling time series with HMMs 21
Motion prediction:
walking patterns
Karg, Michelle, et al. "Human movement analysis: Extension of the f-statistic to time series using hmm." Systems, Man, and Cybernetics (SMC), 2013 IEEE International Conference on. IEEE, 2013.
Modeling time series with HMMs 22
Motion prediction:
models
segmentation
prediction
Modeling time series with HMMs 23
Motion prediction:
models
segmentation
prediction
Modeling time series with HMMs 24
Motion prediction:
dynamical system
Modeling time series with HMMs 25
Motion recognition:
most likely motion and prediction of next step.
MATLAB demo
Toy training set
Modeling time series with HMMs 26
Second part (11:15 – 12:00):
https://github.com/epfl-lasa/ML_toolbox First part (10:15 – 11:00):
Time Data
Modeling time series with HMMs 27
Times-series = Sequence of discrete segments
Why is this an important problem?
Modeling time series with HMMs 28
Segmenting a continuous speech signal into sets of distinct words.
Modeling time series with HMMs 29
I am seafood
diet. I see food and I eat it!
Segmenting a continuous speech signal into sets of distinct words.
Modeling time series with HMMs 30
Emily Fox et al., Sharing Features among Dynamical Systems with Beta Processes, NIPS, 2009
Segmention of Continuous Motion Capture data from exercise routines into motion categories
Jumping Jacks Arm Circles Squats Knee Raises
Modeling time series with HMMs 31
Emily Fox et al.., Sharing Features among Dynamical Systems with Beta Processes, NIPS, 2009
12 Variables
Emily Fox et al., Sharing Features among Dynamical Systems with Beta Processes, NIPS, 2009
Modeling time series with HMMs 32
Learning Complex Sequential Tasks from Demonstration
7 Variables
Reach Grate Trash
Modeling time series with HMMs 33
Assumptions:
hidden states:
current hidden state:
Modeling time series with HMMs 34
How do we find these segments?
Modeling time series with HMMs 35
Initial State Probabilities Transition Matrix Emission Model Parameters Baum-Welch algorithm (Expectation-Maximization for HMMs)
Estimate (MLE):
HMM Likelihood Hyper-parameter: Number of states possible K
Modeling time series with HMMs 36
HMM Joint Probability Distribution
Modeling time series with HMMs 37
Modeling time series with HMMs 38
Modeling time series with HMMs
Modeling time series with HMMs
Modeling time series with HMMs 41
Cardinality: Choice of hidden states is based on Model Selection heuristics, there is little understanding of the strengths and weaknesses of such methods in this setting [1].
[1] Emily Fox et al., An HDP-HMM for Systems with State Persistence, ICML, 2008 [2] Emily Fox et al., Sharing Features among Dynamical Systems with Beta Processes, NIPS, 2009
Topology: We assume that all time series share the same set of emission models and switch among them in exactly the same manner [2]. Undefined # hidden states Fixed Transition Matrix
Modeling time series with HMMs
priors on model parameters!
rather models whose complexity (# of states, # Gaussians) is inferred from the data.
Prior Prior
Modeling time series with HMMs
Cardinality
Hyper- parameters!
Emily Fox et al., An HDP-HMM for Systems with State Persistence, ICML, 2008
Modeling time series with HMMs
Cardinality
a GMM, the K is learned from data. This only gives us an estimate of the K clusters! Cannot be use directly on transition matrix:
Modeling time series with HMMs
Emily Fox et al., An HDP-HMM for Systems with State Persistence, ICML, 2008
Modeling time series with HMMs
Modeling time series with HMMs
Cardinality Topology
Emily Fox et al., Sharing Features among Dynamical Systems with Beta Processes, NIPS, 2009
Modeling time series with HMMs
Cardinality Topology
Features (i.e. shared HMM States) Time-Series
Modeling time series with HMMs 49
Emily Fox et al.., Sharing Features among Dynamical Systems with Beta Processes, NIPS, 2009
12 Variables
Emily Fox et al., Sharing Features among Dynamical Systems with Beta Processes, NIPS, 2009
Modeling time series with HMMs 50
Learning Complex Sequential Tasks from Demonstration