A Novel Entropy-Based Decoding Algorithm for a Generalized High-Order Discrete Hidden Markov Model

The optimal state sequence of a generalized High-Order Hidden Markov Model (HHMM) is tracked from a given observational sequence using the classical Viterbi algorithm. This classical algorithm is based on maximum likelihood criterion. We introduce an entropy-based Viterbi algorithm for tracking the optimal state sequence of a HHMM. The entropy of a state sequence is a useful quantity, providing a measure of the uncertainty of a HHMM. There will be no uncertainty if there is only one possible optimal state sequence for HHMM. This entropy-based decoding algorithm can be formulated in an extended or a reduction approach. We extend the entropy-based algorithm for computing the optimal state sequence that was developed from a first-order to a generalized HHMM with a single observational sequence. This extended algorithm performs the computation exponentially with respect to the order of HMM. The computational complexity of this extended algorithm is due to the growth of the model parameters. We introduce an efficient entropy-based decoding algorithm that used reduction approach, namely, entropy-based order-transformation forward algorithm (EOTFA) to compute the optimal state sequence of any generalized HHMM.This EOTFA algorithm involves a transformation of a generalized high-order HMM into an equivalent first-order HMM and an entropy-based decoding algorithm is developed based on the equivalent first-order HMM. This algorithm performs the computation based on the observational sequence and it requiresO(T?̃?2) calculations, where ?̃? is the number of states in an equivalent first-order model and T is the length of observational sequence.


Introduction
State sequence for the Hidden Markov Model (HMM) is invisible but we can track the most likelihood state sequence based on the model parameter and a given observational sequence.The restored state has many applications especially when the hidden state sequence has meaningful interpretations for making predictions.For example, Ciriza et al. [1] have determined the optimal printing rate based on the HMM model parameter and an optimal time-out based on the restored states.The classical Viterbi algorithm is the most common technique for tracking state sequence from a given observational sequence [2].However, it does not measure the uncertainty present in the solution.Proakis and Salehi [3] proposed a method for measuring the error of a single state but this method is unable to measure the error of the entire state sequence.Hernando et al. [4] proposed a method of using entropy for measuring the uncertainty of the state sequence of a first-order HMM tracked from a single observational sequence with a length of .The method is based on the forward recursion algorithm integrated with entropy for computing the optimal state sequence.Mann and McCallum [5] developed an algorithm for computing the subsequent constrained entropy of HMM which is similar to the probabilistic model conditional random fields (CRF).Ilic [6] developed an algorithm based on forward-backward recursion over the entropy semiring, namely, the Entropy Semiring Forward-Backward (ESRFB) algorithm for a firstorder HMM with a single observational sequence.ESRFB has lower memory requirement as compared with Mann and McCallum's algorithm for subsequent constrained entropy computation.
The uncertainty appearing in a HHMM can be quantified by entropy.This concept is applied for quantifying the uncertainty of the state sequence tracked from a single observational sequence and model parameters.The entropy of the state sequence equals 0 if there is only one possible state sequence that could have generated the observation sequence as there is no uncertainty in the solution.The higher this entropy the higher the uncertainty involved in tracking the hidden state sequence.We extend the entropy-based Viterbi algorithm developed by Hernando et al. [4] for computing the optimal state sequence from a first-order HMM to a highorder HMM, that is, th-order, where  ≥ 2. The state entropy in HHHM is computed recursively for the reason of reducing the computational complexity from (  ) which used direct evaluation method to ( +1 ) in a HHMM where  is the number of states,  is the length of observational sequence, and  is the order of the Hidden Markov Model.In terms of memory space, the entropy-based Viterbi algorithm is more efficient which requires ( +1 ) as compared to the classical Viterbi algorithm which requires ( +1 ).The memory space for the classical Viterbi algorithm is dependent on the length of the observational sequence due to the involvement of the process of "back tracking" in computing the optimal state sequence.
Before introducing the extended entropy-based Viterbi algorithm, we define a generalized high-order HMM, that is, th-order HMM, where  ≥ 2. These are followed by the definition of forward and backward probability variables for a generalized high-order HMM.These variables are required for computing the optimal state sequence in our decoding algorithm.

Elements of HHMM.
HHMM involves two stochastic processes, namely, hidden state process and observation process.The hidden state process cannot be directly observed.However, it can be observed through the observation process.The observational sequence is generated by the observation process incorporated with the hidden state process.For a discrete HHMM, it must satisfy the following conditions.
The hidden state process {  }  =2− is the th-order Markov chain that satisfies where   denotes the hidden state at time  and   ∈ , where  is the finite set of hidden states.The observation process {  }  =1 is incorporated with the hidden state process according to the state probability distribution that satisfies where   denotes the observation at time  and   ∈ , where  is the finite set of observation symbols.
The elements for the th-order discrete HMM are as follows: 1  2 is the probability that model will transit from state   1 and state   2 , 1 ⋅⋅⋅  is the probability that model will transit from state   1 , state   2 , . .., and state    , where  1 is the two-dimensional emission probability matrix and where   is the +1-dimensional emission probability matrix and For the th-order discrete HMM, we summarize the parameters by using the components of  = (   [4] for computing the optimal state sequence of a first-order HMM is incorporated with forward recursion process.Recently, high-order HMM are widely used in a variety of applications such as speech recognition [8,9] and longitudinal data analysis [10,11].For the HHMM, the Markov assumption has been weakened since the next state not only depends on the current state but also depends on other historical states.The state dependency is subjected to the order of HMM.Hence we have to modify the classical forward and backward probability variables for the HHMM, that is, the th-order HMM where  ≥ 2 are shown as follows. Definition 1.The forward variable   ( 2 ,  3 , . . .,  +1 ) in the th-order HMM is a joint probability of the partial observation sequence  1 ,  2 , . . .,   and the hidden state of   2 at time −+1,   3 at time −+2, . . .,   +1 at time  where 1 ≤  ≤ .It can be denoted as From ( 9),  = 1 and 1 ≤  2 ,  3 , . . .,  +1 ≤ , we obtain the initial forward variable as From ( 9), (10), and 1 ≤  1 ,  2 , . . .,   ,  +1 ≤ , we obtain the recursive forward variable for  = 2, . . ., , The probability of the observational sequence given the model parameter for the first-order HMM can be represented by using the classical forward probability and backward probability variables [2].We extend it to HHMM by using our modified forward probability and backward probability variables.The proof is due to Rabiner [2].Definition 3. Let   ( 1 ,  2 , . . .,   ) and   ( 1 ,  2 , . . .,   ) be the forward probability variable and backward probability variable, respectively; ( | ) is presented using the forward and backward probability variables as Proof.
where 1 ≤  ≤ , 1 ≤  1 ,  2 , . . .,   ≤  From ( 14) and ( 22), we obtain the recursive normalized backward probability variable as where Our extended algorithm includes the normalized forward recursion given by ( 18) and (20).The extended algorithm for the th-order HMM requires ( +1 ) calculations if we include either normalized forward recursion given by ( 18) and (20) or the normalized backward recursion given by ( 13) and ( 23).The direct evaluation method, in comparison, requires ( +−1 ) calculations where  is the number of states,  is the length of observational sequence, and  is the order of the Hidden Markov Model.

The Algorithm by Hernando et al. Hernando et al. [4]
are pioneers for using entropy to compute the optimal state sequence of a first-order HMM with a single observational sequence.This algorithm is based on a first-order HMM normalized forward probability, auxiliary probability, and intermediate entropy, The entropy-based algorithm for computing the optimal state sequence of a first-order HMM is as follows [4].
(1) Initialization.For  = 1 and 1 ≤  ≤ , (2) Recursion.For  = 2, . . .,  − 1, and 1 ≤  ≤ , (3) Termination This algorithm performs the computation linearly with respect to the length of the observation sequence with computational complexity ( 2 ).It requires the memory space of ( 2 ) which indicates that the memory space is independent of the observational sequence.

The Computation of the Optimal State
Sequence for a HHMM.The extended classical Viterbi algorithm is commonly used for computing the optimal state sequence for HHMM.This algorithm provides the solution along with its likelihood.This likelihood probability can be determined as follows.(31)

𝑃 (𝑞
This probability can be used as a measure of quality of the solution.The higher the probability of our "solution," the better our "solution."Entropy can also be used for measuring the quality of the state sequence of the th-order HMM.Hence, state entropy is proposed to be used for obtaining the optimal state sequence of a HHMM.We define entropy of a discrete random variable as follows [12].Definition 6.The entropy () of a discrete random variable  with a probability mass function ( = ) is defined as When the log has a base of 2, the unit of the entropy is bits.Note that 0 log 0 = 0. From (32), the entropy of the distribution for all possible state sequences is as follows: For the first-order HMM, if all   possible state sequences are equally likely to generate a single observational sequence with a length of , then the entropy equals  log 2 .The entropy is  log 2  in the th-order HMM if all   possible state sequences are equally likely to produce the observational sequence.
We define the state entropy variable for the th-order HMM as follows.
Definition 7. The state entropy variable,   (  2 ,   3 , . . .,   +1 ), in the th-order HMM is the entropy of all the state sequences that lead to state of   2 at time  −  + 1,   3 at time  −  + 2, . .., and   +1 at time , given the observation sequence  1 ,  2 , . . .,   .It can be denoted as We analyse the state entropy for the th-order HMM in detail, shown as follows.

Numerical Illustration for the Second-Order HMM.
We consider a second-order HMM for illustrating our extended entropy-based algorithm in computing the optimal state sequence.Let us assume that this second-order HMM has the state space , which is  = { 1 ,  2 } and the possible symbols per observation which is The graphical representation of the first-order HMM that is used for the numerical example in this section is given in a 11 = 0.5 a 12 = 0.5 The graphical diagram shows a first-order HMM with 2 states and 3 observational symbols.Figure 1.The second-order HMM in Figure 2 is developed based on the first-order HMM in Figure 1 which has two states and three observational symbols.A HMM of any order has the parameters of  = (, , ) where  is the initial state probability vector,  is the state transition probability matrix, and  is the emission probability matrix.Note that the matrices of  and  whose components are indicated as   1  2 ,   1  2  3 ,   2 (  = V  ) and   2  3 (  = V  ) where 1 ≤  1 ,  2 ,  3 ≤ 2 and 1 ≤  ≤ 3 can be obtained from Figures 1 and 2. However, the initial state probability vector is not shown in the above graphical diagrams.
The initial state probability vectors for the first-order and second-order HMM are shown as follows: is the initial state probability vector for the firstorder HMM and  2 = { π  2 1 } and  3 = { π  2 2 } are the initial state probability vectors for the second-order HMM where The state transition probability matrices for the first-order and second-order HMMs are shown as follows: (47) The emission probability matrices for the first-order and second-order HMMs are shown as follows: 1 = {  2 (  = V  )} is the emission probability matrix for the first-order HMM and )}, and  4 = {  2  3 (  = V 3 )} are the emission probability matrices for the second-order HMM where The following is the observational sequence that we used for illustrating our extended algorithm: We applied our extended algorithm for computing the optimal state sequence based on state entropy.The computed value of the state entropy is shown in Figure 3.The total entropy after each time step is displayed at the bottom of Figure 3.For example, after receiving the second observation, that is, , it has produced two state sequences which are  1:2 = ( 1 =  1 ,  2 =  1 ) and  1:2 = ( 1 =  1 ,  2 =  2 ) as shown by the bold arrows.Each possible state sequence has a probability of 0.5; that is, α2 (1, 1) = α2 (1, 2) = 0.5, and hence the total entropy is 1 bit.

Obs State
However, after receiving the fourth observation, that is, , it has produced one state sequence which is as shown by the dashed arrow.This possible state sequence has a probability of 1, that is, α4 (1, 2) = 1, and hence the total entropy is 0 bit.After receiving the sixth observation, this second-order HMM has produced only one possible optimal state sequence; that is, with the total entropy of 0 which indicates that there is no uncertainty.

Entropy-Based Decoding Algorithm with a Reduction Approach
The extended entropy-based Viterbi algorithm in Section 2 has addressed only the issue related to memory space but this algorithm is not able to overcome the computational complexity.In this section, we introduce an efficient entropy-based algorithm that used reduction approach, namely, entropy-based order-transformation forward algorithm (EOTFA) to compute the optimal state sequence based on entropy of any generalized HHMM.This algorithm has addressed issues related to memory space and computational complexity.

3.1.
Transforming a High-Order HMM with a Single Observational Sequence.This EOTFA algorithm involves a transformation of a generalized high-order HMM into an equivalent first-order HMM and an algorithm is developed based on the equivalent first-order HMM.This algorithm performs the computation based on the observational sequence and it requires ( Ñ2 ) calculations, where Ñ is the number of states in an equivalent first-order model and  is the length of observational sequence.The transformation of a generalized high-order HMM into an equivalent first-order HMM is based on Hadar and Messer's method [7].
The observation process {  }  =1 satisfies Hence, the hidden state process { Q }  =1 and the observation process {  }  =1 form the first-order HMM. where where The elements for the transformation of a high-order into an equivalent first-order discrete HMM are as follows: (58) The normalized forward variable at time  is as follows: where  •  = ∑ Ñ =1 ∑ Ñ =1 α−1 ()ã  b (  ).The normalized backward variables at time  is as follows: where

The Computation of the Optimal State Sequence for a HHMM.
For EOFTA algorithm, we require state entropy variable,   (s  ), that can be computed recursively using the previous variable,  −1 (s  ).
We define the state entropy variable as follows.
Definition 10.The state entropy variable,   (s  ), in an ordertransformation HMM, is the entropy of all the paths that lead to state of s at time , given the observations  1 ,  2 , . . .,   .It can be denoted as From (61) at  = 1, we obtain the initial state entropy variable as From ( 61) and ( 62 For the final process, we compute ( 1: |  1: ) which can be expanded as follows: The basic entropy concept in (40) and the following basic properties of HMM are used for proving our Lemma 11.
According to the transformation of a high-order into an equivalent first-order HMM, state Q− ,  ≥ 2, and Q are statistically independent given Q−1 .The same applies to Q− ,  ≥ 2 and   are statistically independent given Q−1 .
The following proof is due to Hernando et al. [4].

13
(2) Recursion.For  = 2, . . .,  and 1 The direct evaluation algorithm, Hernando et al. 's algorithm, and our algorithm perform the computation of state entropy exponentially with respect to the order of HMM.Our algorithm proposes the transformation of a generalized high-order into an equivalent first-order HMM and then compute the state entropy based on the equivalent first-order model; hence our algorithm is the most efficient in which it requires ( Ñ2 ) calculations as compared to the direct evaluation method which requires ( +−1 ) calculations and the extended algorithm which requires ( +1 ) calculations where  is the number of states in a model, Ñ is the number of states in an equivalent first-order model,  is the length of observational sequence, and  is the order of HMM.

Numerical Illustration for an Equivalent First-Order
HMM.We consider the second-order HMM in Section 2.5 for illustrating our EOTFA algorithm in computing the optimal state sequence.According to our proposed novel algorithm, we first transformed the second-order HMM in Section 2.5 into the equivalent first-order HMM by using Hadar and Messer method [7].The equivalent first-order HMM has the following model parameters λ = (π, Ã, B), where π is the initial state probability vector, Ã is the state transition probability matrix, and B is the emission probability matrix.
Note that the above state transition probability and the emission probability matrices whose components are indicated as ã 1  2 and b 2 (  = V  ) where 1 ≤  1 ,  2 ≤ 4 and 1 ≤  ≤ 3 can be obtained from the graphical diagram in Figure 4.
The state space for the equivalent first-order HMM is S = {s 1 , s2 , s3 , s4 }, where s1 The equivalent first-order HMM was developed based on Hadar and Messer's method [7] is shown in Figure 4.
Secondly, the optimal state sequence is computed based on the equivalent first-order HMM by using our proposed algorithm.Finally, the optimal state sequence of the secondorder HMM is inferred from the optimal state sequence from the equivalent first-order HMM.
The following is the observational sequence used for illustrating our algorithm: We applied our EOFTA algorithm for computing the optimal state sequence based on the state entropy.The computed value of state entropy is shown in Figure 5.
The total entropy after each time step for the transformed model, that is, the second-order transformed into the equivalent first-order HMM is displayed at the bottom of Figure 5.For example, this model has produced only one possible state sequence; that is, Q1:5 = ( Q1 = s1 , Q2 = s2 , Q3 = s3 , Q4 = s2 , Q5 = s3 ), as shown by the bold arrow with a probability of 1 after receiving the fifth observation.The total entropy is 0 at  = 5 which indicates that there is no uncertainty.After receiving the sixth observation, that is,  1:6 = ( ), this equivalent first-order HMM has produced one possible optimal state sequence Q1:6 = ( Q1 = s1 , Q2 = s2 , Q3 = s3 , Q4 = s2 , Q5 = s3 , Q6 = s2 ) which is similar to  1:6 = ( 1 =  1 ,  2 =  2 ,  3 =  1 ,  4 =  2 ,  5 =  1 ,  6 =  2 ) that is produced by the secondorder HMM in Section 2.5 with a total entropy of 0 which indicates that there is no uncertainty.As a result, the optimal state sequence of the high-order HMM is inferred from the optimal state sequence of the equivalent first-order HMM.
Our proposed algorithm is based on the equivalent first-order HMM and only requires ( Ñ2 ) computation and hence we can conclude that our EOTFA algorithm is more efficient.

Conclusion and Future Work
We have introduced a novel algorithm for computing the optimal state sequence for HHMM that requires ( Ñ2 ) calculations and ( Ñ2 ) memory space where Ñ is the number of states in an equivalent first-order HMM and  is the length of observational sequence.This algorithm is to be running with Viterbi algorithm in tracking the optimal state sequence as well as the entropy of the distribution of the state sequence.We have developed this algorithm for the case of a generalized discrete high-order HMM.This research can be also extended for continuous high-order HMMs and these models are widely used in speech recognition.

Figure 2 :
Figure 2: The graphical diagram shows a second-order HMM with 2 states and 3 observational symbols.

1 Figure 4 :Figure 5 :
Figure 4: The graphical diagram shows an equivalent first-order HMM.