SPSC – Advanced Signal Processing Seminar 2
1
Walch Daniel Graz, 17. 5. 2011 Graphical Models for Time Series
Graphical Models for Time Series
Gaining insight into their computational implementation
SPSC – Advanced Signal Processing Seminar 2
2
Walch Daniel Graz, 17. 5. 2011 Graphical Models for Time Series
Contents
• Time Series – short Introduction
• Developing a graphical representation
• Latent Markov models
• Switching Linear Dynamical Systems (SLDS)
• Gaußian Sum Filtering
• Noisy Signal Reconstruction
• Example: Traffic flow
• Reset models
• Conclusions
SPSC – Advanced Signal Processing Seminar 2
3
Walch Daniel Graz, 17. 5. 2011 Graphical Models for Time Series
Time Series
• Realizations (samples) from a process • Process itself is non-random, but
• Random influences (noise)
• TS analysis is central to many problems • Signal Processing
• Finance
SPSC – Advanced Signal Processing Seminar 2
4
Walch Daniel Graz, 17. 5. 2011 Graphical Models for Time Series
Time Series
• Examples
SPSC – Advanced Signal Processing Seminar 2
5
Walch Daniel Graz, 17. 5. 2011 Graphical Models for Time Series
Developing a Graphical Representation
• Notation: 𝑦1:𝑇 = 𝑦1, … , 𝑦𝑇 … time series
• A probabilistic model of a time series is a
specification of a joint distribution 𝑝 𝑦1:𝑇
• Bayes‘ rule:
𝑝 𝐴 𝐵 =𝑝(𝐴, 𝐵)
𝑝(𝐵)
𝑝 𝑦1:𝑇 = 𝑝 𝑦𝑇 𝑦1:𝑇−1 𝑝(𝑦1:𝑇−1)
SPSC – Advanced Signal Processing Seminar 2
6
Walch Daniel Graz, 17. 5. 2011 Graphical Models for Time Series
Developing a Graphical Representation
𝑝 𝑦1:𝑇 = 𝑝 𝑦𝑇 𝑦1:𝑇−1 𝑝(𝑦1:𝑇−1)
• Recursively applying Bayes‘ rule, any distribution can
be written in a causal form:
𝑝 𝑦1:𝑇 = 𝑝(𝑦𝑡|𝑦1:𝑡−1)
𝑇
𝑖=1
• For each factor, the present depends only on the
past!
𝑝 𝑦1, … , 𝑦𝑁 = 𝑝(𝑦𝑖|pa(
𝑁
𝑖=1
𝑦𝑖))
SPSC – Advanced Signal Processing Seminar 2
7
Walch Daniel Graz, 17. 5. 2011 Graphical Models for Time Series
Graphical Model
• Each node represents a variable 𝑦𝑖.
• Variables that point to 𝑦𝑖 are parents of this variable.
• Applied to belief networks, each node corresponds to
a factor in the joint distribution over all variables
• Example (blackboard)
SPSC – Advanced Signal Processing Seminar 2
8
Walch Daniel Graz, 17. 5. 2011 Graphical Models for Time Series
Some examples
𝑝 𝑦1, … , 𝑦𝑁 = 𝑝(𝑦𝑖|pa(
𝑁
𝑖=1
𝑦𝑖))
• First order Markov model: pa 𝑦𝑖 = 𝑦𝑖−1
• Second order Markov model: pa 𝑦𝑖 = 𝑦𝑖−1, 𝑦𝑖−2
• Lth order auto-regressive model 𝑦𝑡 = 𝑎𝑙𝑦𝑡−𝑙 + η𝑡𝐿𝑖=1
with η𝑡~𝑁(η𝑡|0, 𝜎2) corresponds to the transition
𝑝 𝑦𝑡 𝑦𝑡−𝐿:𝑡−1 = 𝑁 𝑦𝑡| 𝑎𝑙𝑦𝑡−𝑙
𝐿
𝑙=1
, 𝜎2
SPSC – Advanced Signal Processing Seminar 2
9
Walch Daniel Graz, 17. 5. 2011 Graphical Models for Time Series
Parameter Learning
• Parameter θ of a model in 𝑝 𝑦1:𝑇 𝜃
• Bayes: 𝑝 𝑦1:𝑇 , 𝜃 = 𝑝 𝑦1:𝑇 𝜃 𝑝 𝜃
• All questions relating to parameter estimation are
computed from the parameter posteriori density
𝑝 𝜃 𝑦1:𝑇 =𝑝 𝑦1:𝑇 𝜃 𝑝(𝜃)
𝑝(𝑦1:𝑇)
• First order Markov model:
𝑝 𝑦1:𝑇 , 𝜃 = 𝑝(𝜃) 𝑝(𝑦𝑡|𝑦𝑡−1, 𝜃)
𝑡
Sketch on blackboard!
SPSC – Advanced Signal Processing Seminar 2
10
Walch Daniel Graz, 17. 5. 2011 Graphical Models for Time Series
Latent Markov Models
• Unobserved variable 𝑥𝑡
• Observations 𝑦𝑡
• Example: Tracking an object
𝑥𝑡 is the position of the object that is assumed to move
according a transition dynamics 𝑝 𝑥𝑡 𝑥𝑡−1 and 𝑦𝑡 is a
noisy function of it
(noisy radar reading 𝑦𝑡 of the approximate distance to
the object)
SPSC – Advanced Signal Processing Seminar 2
11
Walch Daniel Graz, 17. 5. 2011 Graphical Models for Time Series
HMM (hidden Markov model)
• „Discrete Latent State Markov Models“
• The latent variables 𝑥𝑡 are discrete (square nodes)
• The observations 𝑦𝑡 can be continuous or discrete
• Able to model discrete changes in the underlying
state
SPSC – Advanced Signal Processing Seminar 2
12
Walch Daniel Graz, 17. 5. 2011 Graphical Models for Time Series
Continuous State Latent Markov Models
• Continuous variable distributions analytically
seldom tractable
• LDS (Linear Dynamical Systems) play a special role
(LDS ≜ discrete-state HMM)
𝑥𝑡 = 𝐴𝑥𝑡−1 + 𝜂𝑡, 𝑦𝑡 = 𝐶𝑥𝑡 + 𝜐𝑡
𝜂𝑡, 𝜐𝑡 … Gaussian noise terms
≜ Kalman filtering
• As a probabilistic model, the LDS corresponds to
𝑝 𝑥𝑡 𝑥𝑡−1 = 𝑁 𝑥𝑡 𝐴𝑥𝑡−1, 𝑄 , 𝑝 𝑦𝑡 𝑥𝑡 = 𝑁(𝑦𝑡|𝐶𝑥𝑡 , 𝑅)
SPSC – Advanced Signal Processing Seminar 2
13
Walch Daniel Graz, 17. 5. 2011 Graphical Models for Time Series
Inference in Latent Markov Models
• We often want to infer the distribution of the latent
state 𝑥𝑡 based on noisy observations.
• Notation: 𝑑𝑋, that either integrates or sums over the
domain of X.
• Conclusions that will be drawn: • Same procedure applies in all models consistent with the belief
network representation
• Can numerically only be implemented in a restricted class of
transition and observation distributions (discrete latent variables
(HMM) and linear Gaußian transition and observations (LDS) –
Kalman filter)
SPSC – Advanced Signal Processing Seminar 2
14
Walch Daniel Graz, 17. 5. 2011 Graphical Models for Time Series
Latent Markov Models:
Filtering/Smoothing • Probably skip this section
SPSC – Advanced Signal Processing Seminar 2
15
Walch Daniel Graz, 17. 5. 2011 Graphical Models for Time Series
Inference in Linear Dynamical Systems
• Probably skip this section
• Well-known Kalman filtering and smoothing
recursions.
SPSC – Advanced Signal Processing Seminar 2
16
Walch Daniel Graz, 17. 5. 2011 Graphical Models for Time Series
Switching Linear Dynamical System
• „Marrying“ HMM and LDS: breaking the time series
into segments, each modelled by a (different) LDS
• Useful when the underlying model may change from
one parameter setting to another
• Application in econometrics and machine learning
SPSC – Advanced Signal Processing Seminar 2
17
Walch Daniel Graz, 17. 5. 2011 Graphical Models for Time Series
Exact inference?
𝛼 𝑠𝑡 , 𝑥𝑡 = 𝑝(𝑦𝑡|𝑥𝑡 , 𝑠𝑡)
∙ 𝑝(𝑠𝑡 , 𝑥𝑡|𝑠𝑡−1, 𝑥𝑡−1, 𝑦𝑡)𝛼(𝑠𝑡−1, 𝑥𝑡−1)𝑥𝑡−1𝑠𝑡−1
• Computationally intractable
• Summation over the states 𝑠𝑡 exponentially many
Gaußians 𝑆𝑡−1, at time 𝑡.
• Approximate inference necessary (Monte Carlo
methods, deterministic variational techniques, and …
SPSC – Advanced Signal Processing Seminar 2
18
Walch Daniel Graz, 17. 5. 2011 Graphical Models for Time Series
Gaußian Sum Filtering
• Keep the exponential explosion in check
• S² Gaußian mixture is collapsed back to an S
component Gaußian mixture.
• Example: Two states (S = 2), three mixture
components (I = 3)
SPSC – Advanced Signal Processing Seminar 2
19
Walch Daniel Graz, 17. 5. 2011 Graphical Models for Time Series
Gaußian Sum Filtering
Two states: Red and Blue
Three mixture states I = 3
Area of ellipse
corresponds to the weight
of each component
One method: ignore the
lowest weight components
SPSC – Advanced Signal Processing Seminar 2
20
Walch Daniel Graz, 17. 5. 2011 Graphical Models for Time Series
Noisy Signal Reconstruction
• Example: SAR model (essentially an HMM)
• 𝑥𝑡 indicate which of a set of AR models is active
SPSC – Advanced Signal Processing Seminar 2
21
Walch Daniel Graz, 17. 5. 2011 Graphical Models for Time Series
Noisy Signal Reconstruction (cont‘d)
SPSC – Advanced Signal Processing Seminar 2
22
Walch Daniel Graz, 17. 5. 2011 Graphical Models for Time Series
Traffic Flow
• Traffic flows into junction a
• Goes to d via different routes
• a and b with traffic lights
• Routing dependent on
state
SPSC – Advanced Signal Processing Seminar 2
23
Walch Daniel Graz, 17. 5. 2011 Graphical Models for Time Series
Traffic flow (cont‘d)
• Time evolution of the traffic flow (into the network and
out of the network)
SPSC – Advanced Signal Processing Seminar 2
24
Walch Daniel Graz, 17. 5. 2011 Graphical Models for Time Series
Traffic flow (cont‘d)
(a) Correct latent flows and switch variables
(b) Filtered flow based on I = 2 Gaußian sum forward
pass algorithm
(c) Smoothed flows and traffic light states
SPSC – Advanced Signal Processing Seminar 2
25
Walch Daniel Graz, 17. 5. 2011 Graphical Models for Time Series
Traffic flow (cont‘d)
SPSC – Advanced Signal Processing Seminar 2
26
Walch Daniel Graz, 17. 5. 2011 Graphical Models for Time Series
Reset models
• Switching LDS powerful, but computationally difficult
to implement
• Reset model: Switching models where the switch can
reset the latent 𝑥𝑡 (isolating present from the past)
SPSC – Advanced Signal Processing Seminar 2
27
Walch Daniel Graz, 17. 5. 2011 Graphical Models for Time Series
Example: Poisson reset model
• Intensity constant, but may „jump“
• 𝑐𝑡 indicates wheter there is a jump or not
• Deadly coal mining desasters in England
SPSC – Advanced Signal Processing Seminar 2
28
Walch Daniel Graz, 17. 5. 2011 Graphical Models for Time Series
Conclusions
• Graphical models provide a compact description of
the basic independence assumptions behind a model
• A useful way of communicating ideas
• Makes it easy to envisage new models tailored for a
particular environment
Thank you for your attention!
SPSC – Advanced Signal Processing Seminar 2
29
Walch Daniel Graz, 17. 5. 2011 Graphical Models for Time Series
References
[1] „Graphical Models for Time Series“, D. Barber, A. T.
Cemgil, IEEE Signal Processing Magazine,
November 2010
[2]
http://upload.wikimedia.org/wikipedia/commons/9/94/I
ntVerglArblos.PNG, visited 2011-05-16
[3] http://blog.iwenzo.de/wp-
content/uploads/2008/02/boersenkurs.gif, visited
2011-05-16
SPSC – Advanced Signal Processing Seminar 2
30
Walch Daniel Graz, 17. 5. 2011 Graphical Models for Time Series
References (cont‘d)
[4]
http://read.pudn.com/downloads187/sourcecode/mat
h/877147/kalman%2520simulink/html/runkalmanfilter
_01.png, visited 2011-05-16