MarkovHMMPython Intro
MarkovHMMPython Intro
HMM
What is a Hidden Markov Model (HMM)?
A hidden Markov model is a statistical model which builds upon the
concept of a Markov chain.
The idea behind the model is simple: imagine your system can be
modeled as a Markov chain and the signals emitted by the system
depend only on the current state of the system. If the states of the
system are not visible and what you can observe are only the emitted
signals, then this is a Hidden Markov model.
Imagine
You were locked in a room for several days and you were asked about
the weather outside. The only piece of evidence you have is whether
the person who comes into the room bringing your daily meal is
carrying an umbrella or not.
U = Umbrella
NU = Not Umbrella
Imagine
As an example, imagine you have a friend in another country whose
activities depend only on the weather. According to the weather
conditions he is more likely to do some activities instead of others
however (assuming you have no smartphone ;)) you cannot observe
the weather in his country and you only have a report with a sequence
of activities.
What is a Hidden Markov Model (HMM)?
The HMM is a generative probabilistic model, in which a sequence of
observable X variables is generated by a sequence of internal hidden
states Z.
The hidden states are not observed directly. The transitions between
hidden states are assumed to have the form of a (first-order) Markov
chain. They can be specified by the start probability vector π and a
transition probability matrix A. The emission probability of an
observable can be any distribution with parameters θ conditioned on
the current hidden state. The HMM is completely determined by π, A
and θ.
What is a Hidden Markov Model (HMM)?
The three top problems you might want to solve are:
start = ['R','Su']
#Start probability
p_start = [0.2,0.8]
Imagine
#t1 = [['R|R','Su|R'],['R|Su','Su|Su']]
#Transition probability
t1 = ['R','Su']
p_t1=[[0.4,0.6],[0.3,0.7]]
#t2 = [['W|R','Sh|R','C|R'],['W|Su','Sh|Su','C|Su']]
t2 = ['Walk','Shop','Clean']
#Emission probability
p_t2=[[0.1,0.4,0.5],[0.6,0.3,0.1]]
Imagine
The whole code:
Markov_03.py
HMM Applications
Due to the powerfulness that Markov models provide, it can be used
anywhere sequential information exists:
• Finance
• Biology
• Tracking systems
• Speech processing
• Image processing
• Communication systems
HMM Applications
Model non-stationary and non-linearity of financial data to predict the
direction of the time series.
HMM Applications
DNA is composed if 4 bases (A, G, T, C) which pair together form
nucleotides. Markov models can compute likelihoods of an DNA
sequence.
HMM Applications
Markov models can be used to estimate the position in a tracking
system.
HMM Applications
Speech recognition has been the most exploited area for use of Markov
models.
HMM Applications
Human action recognition can be modeled with Markov models
HMM Applications
What app is this one?
HMM Applications
What app is this one?