## 3 Methods
### Theroy of Hidden Markov Model
#### 3.1.2 HMM Parameter Learning  
The parameter learning algorithm is called the Baum-Welch algorithm [40], which iteratively optimizes the parameters of the HMM. Let \((\Omega,\,F,\,P)\) be the probability space and \(\left\{Y_{t}\right\}_{1\;\leq\;t\;\leq\;T}\) and \(\left\{X_{t}\right\}_{1\;\leq\;t\;\leq\;T}\) be sequences of random variables of observable and hidden states, where \(X_{t}:\;\Omega\to S_{1},S_{2},\ldots,S_{m}\) and \(Y_{t}:\;F\to\mathrm{N}\) or any set of possible states.  
The specific implementation steps are as follows:  
Step 1: In the given sample training space, the first observation sequence \(y\;=\;(y_{1},y_{2},\ldots,y_{T})\) is trained and the initial model parameters are re-estimated to obtain the model parameters \(\lambda_{1}\;=\;(\pi_{1},A_{1},B_{1})\), where \(\pi_{1}\) stands for the distribution of hidden states, \(A_{1}\) is the transition probability matrix, and \(B_{1}\) represents the distribution of observable states.  
Step 2: The observation sequence \(y\;=\;(y_{1},y_{2},\ldots,y_{T})\) is trained using the new re-estimated parameters \(\lambda_{1}\;=\;(\pi_{1},A_{1},B_{1})\) to obtain the next new model parameters \(\lambda_{2}\;=\;(\pi_{2},A_{2},B_{2})\).  
Step 3: Step 2 is repeated until the model converges. Using the three re-estimation equations mentioned below, the initial parameters of the HMM model are updated from \(\lambda_{0}\;=\;(\pi_{0},A_{0},B_{0})\) to \(\lambda\;=\;(\pi,A,B)\), satisfying \(P(y\big{|}\lambda)\geq P(y\big{|}\lambda_{0})\).  
The parameter re-estimation equations are as follows.  
\[\pi^{\prime}\;=\;\gamma_{1}(i)\;=\;\frac{\alpha_{1}(i)\cdot\beta_{1}(i)}{\sum _{i\;=\;1}^{m}\alpha_{1}(i)\cdot\beta_{1}(i)}. \tag{1}\]  
\[a_{t}(i,j)^{\prime}\;=\;\frac{\xi_{t}(i,j)}{\gamma_{t}(i)}. \tag{2}\]  
\[b_{t}(y_{t})^{\prime}\;=\;\frac{\alpha_{t}(i)\cdot\beta_{t}(i)}{\sum_{i\;=\;1 }^{m}\alpha_{t}(i)\cdot\beta_{t}(i)}. \tag{3}\]  
Figure 1: Relationship between hidden states and observations in the hidden Markov model (HMM).  
In Equation (1), \(\pi^{\prime}\) is the estimation of initial probability \(\pi\), and it stands for the probability of the hidden risk state \(S_{i}\) at time \(t=1\); \(\alpha_{t}(i)\) represents the forward probability function of the observation \(O~{}=~{}(y_{1},y_{2},\ldots y_{t})\) at time \(t\) in state \(i\), and \(\beta_{t}(i)\) stands for the backward probability of the partial observation sequence from time step \(t+1\) to the end. In Equation (2), \(a_{t}(i,j)\), is the estimation of state transition probability \(a_{t}(i,j)\), and it stands for the quotient of frequency of the risk state transition from state \(S_{i}\) to \(S_{j}\) divided by the frequency of the hidden state transition from state \(s_{i}\) to others; \(\xi_{t}(i,j)=P\Big{(}X_{t}~{}=~{}S_{i}\Big{|}X_{t+1}~{}=~{}S_{j}\Big{)}\) is the probability of being in state \(S_{i}\) at time \(t\) and state \(S_{j}\) at time \(t+1\), while \(\gamma_{t}(i)~{}=~{}P(X_{t}~{}=~{}S_{i})\) is the probability of being in state \(S_{i}\) at time \(t\). In Equation (3), \(b_{i}(y_{t})\), is the estimation of observation probability \(b_{i}(y_{t})\), and it stands for the quotient of frequency of the observed state \(O_{i}\) from hidden state \(S_{i}\) divided by the frequency of observation from the hidden state \(S_{i}\).