A list,
Hidden Markov Model (HMM) is a dynamic Bayesian network generation model with the simplest structure. It is also a famous directed graph model. It is a typical statistical machine learning model to deal with annotation problems in natural languages. This paper will focus on this classical machine learning model. 1 the introduction
Suppose there are three different dice (6 sides, 4 sides, 8 sides), first choose one of the three dice each time, the probability of each dice being selected is 1/3, as shown in the figure below. Repeat the above process to get a string of values [1,6,3,5,2,7]. These observable variables form the observable state chain. At the same time, there is an implicit state chain composed of implicit variables in the hidden Markov model, which in this case is the sequence of dice. For example, the sequence of the numeric dice might be [D6, D8, D8, D6, D4, D8].
The schematic diagram of the hidden Markov type is as follows:
In the figure, the arrows represent the dependencies between variables. The arrows in the figure are described as follows:
At any given time, the observation variable (dice) depends only on the state variable (what kind of dice), and the state qt at time T depends only on the state Qt-1 at time t-1. This is the Markov chain, the next moment of the system is determined only by the current state (no memory), the homogeneous Markov hypothesis.
2. Definition of hidden Markov model
Based on the above example, the definition of hidden Markov is given here. Hidden markov models is about probability model of time sequence, described by a hidden markov chain unobservable state randomly generated random sequence, and then by each state the process of generating a random sequence to observe, hidden markov chain state of randomly generated sequence, known as the state sequence (D6 in the example above, the D8, etc.); Each state generates an observation, and the resulting random sequence of observations is called an observation sequence (i.e., 1,6, etc., in the example above). Each position in the sequence can again be seen as a moment.
The hidden Markov model is determined by the initial probability distribution, state transition probability distribution and observation probability distribution. The specific form is as follows. Here, Q is the set of all possible states and V is the set of all possible observations, namely:
3. Forward algorithm
For the initial of step 1, is the joint probability of the state i1 = Q1 and the observation O1 at the initial time. Step (2) is the recursive formula of the forward probability, and the observation sequence at time t+1 is calculated as O1, O2… ,ot,ot+1 and the forward probability of state QI at time t+1. As shown in the figure above, since at(j) is obtained at time t, o1, O2… ,ot and qj forward probability of being in state at time t, then at(j)aji is o1, O2… ,ot and is the joint probability of being in qj state at time t and reaching QI state at time t+1. The sum of all the N possible states of the product at time t is o1, O2… ,ot, and the joint probability of state QI at time t+1. The third step, calculate the P (O | lambda) results.
Of course, this is only one of many algorithms introduced, as well as backward algorithms (you can see the relevant books for understanding). Viterbi algorithm is widely used in dynamic programming to solve hidden Markov model prediction problems.
Ii. Source code
Insert the code slice hereCopy the code
- 1