# Patent

## Title
Calculating cost measures between HMM acoustic models

## Abstract

Measurement of Kullback-Leibler Divergence (KLD) between hidden Markov models (HMM) of acoustic units utilizes an unscented transform to approximate KLD between Gaussian mixtures. Dynamic programming equalizes the number of states between HMMs having a different number of states, while the total KLD of the HMMs is obtained by summing individual KLDs calculated by state pair by state pair comparisons.

## Background
BACKGROUND
The discussion below is merely provided for general background information and is not intended to be used as an aid in determining the scope of the claimed subject matter.
In speech processing such as but not limited to speech recognition and speech synthesis, a reoccurring problem is measuring the similarity of two given speech units, e.g. phones, words. Although acoustic models for speech units have taken many forms, one particularly useful form is the Hidden Markov Model (HMM) acoustic model, which describes each speech unit statistically as an evolving stochastic process. Commonly, Gaussian Mixtures Models, which are flexible to fit various spectrums as continuous probability distributions, are widely adopted as a default standard for the acoustic models.
Kullback-Leibler Divergence (KLD) is a meaningful statistical measure of the dissimilarity between probabilistic distributions. However, problems exist in order to perform a KLD calculation to measure the acoustic similarity of two speech units. One significant problem is caused by the high model complexity. Actually, the KLD between two Gaussian mixtures cannot be computed in a closed form, and therefore, an effective approximation is needed. In statistics, KLD arises as an expected logarithm of the likelihood ratio, so it can be approximated by sampling based Monte-Carlo algorithm, in which an average over a large number of random samples is generated. Besides this basic sampling method, Gibbs sampling and Markov Chain Monte Carlo (MCMC) can be used, but they are still too time-consuming to be applied to many practical applications.
KLD rate has also been used as a calculation between two HMMs. However, the physical meaning of KLD and KLD rate are different. KLD rate measures the similarity between the steady-states of the two HMM processes, while KLD compares the two entire processes. In speech processing, the dynamic evolution can be more important than the steady-states, so it is necessary to measure KLD directly. Nevertheless, a closed form solution is not available when using Gaussian Mixture Models (GMMs).
SUMMARY
The Summary and Abstract are provided to introduce a selection of concepts in a simplified form that are further described below in the Detailed Description. The Summary and Abstract are not intended to identify key features or essential features of the claimed subject matter, nor are they intended to be used as an aid in determining the scope of the claimed subject matter. In addition, the claimed subject matter is not limited to implementations that solve any or all disadvantages noted in the background.
Use of Kullback-Leibler Divergence (KLD) has been discovered to be a useful measurement between hidden Markov models (HMM) of acoustic models such as acoustic models used in but not limited to speech synthesis. In particular measurement of KLD utilizes an unscented transform to approximate KLD between the Gaussian mixtures of the HMM acoustic models. In one aspect, a method for measuring the total Kullback-Leibler Divergence of two hidden Markov models (HMM) includes calculating an individual KLD for each pair of states, state by state, for the two HMMs. The individual KLDs are then summed together to obtain a total KLD for the two HMMs.
In a further embodiment, in order to make a comparison between HMMs having a different number of states, modifications are made to one or both of the HMMs in order to equalize the number of states so that individual KLDs can be calculated on a state by state basis. The modifications include operations taken from a set of operations including inserting a state, deleting a state and substituting a state. Each operation includes a corresponding penalty value. Modifications are made in order to minimize the total of the penalty values.



BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 is a block diagram of a language processing system.
FIG. 2 is a schematic diagram illustrating mismatch between HMM models.
FIG. 3 is a flowchart of a method for calculating KLD.
FIG. 4 is a schematic diagram of state duplication (copy) with a penalty.
FIG. 5 is a schematic diagram illustrating possible operations to add a state to an HMM.
FIG. 6 is a schematic diagram illustrating modifying two HMMs based on a set of operations and calculating KLD.
FIG. 7 is a flowchart for the diagram of FIG. 10.
FIG. 8 is one illustrative example of state matching of two HMMs.
FIG. 9 is an exemplary computing environment.
FIG. 10 is a second illustrative example of state matching of two HMMs.



DETAILED DESCRIPTION
An application processing module that uses speech units in the form of acoustic HMM models is illustrated at 100. Application processing module 100 generically represents any one or a combination of well known speech processing applications such as but not limited to speech recognition, training of acoustic HMM models for speech recognizers, speech synthesis, or training of acoustic HMM models for speech synthesizers.
An acoustic HMM model comparison module 102 provides as an output 104 information related to one or more sorted acoustic HMM models that is used by the application processing module 100. For instance, the output information 104 can comprise the actual acoustic HMM model(s), or an identifier(s) used to obtain the actual acoustic HMM model(s).
The acoustic HMM model comparison module 102 uses a KLD calculating module 106. The KLD calculating module 106 obtains an approximation of the KLD using an unscented transform between the Gaussian mixtures of two HMM acoustic models, provided either from a single set of acoustic HMM models 108, or a comparison between pairs of HMM models taken from the acoustic HMM model(s) in set 108 and one or more acoustic HMM model(s) in set 110. In a further embodiment, a speech unit processing system 112 can include both the application processing module 100 and the acoustic HMM model comparison module 102 with feedback 114, if necessary, between the modules.
Kullback-Leibler Divergence (KLD) is used to measure the dissimilarity between two HMM acoustic models. In terms of KLD, the target cost can be represented as:




  
    
      
        
          
            C
            t
          
          ⁡
          
            (
            
              t
              ,
              u
            
            )
          
        
        =
        
          
            ∑
            
              j
              =
              1
            
            J
          
          ⁢
          
            
              w
              j
              t
            
            ⁢
            
              D
              ⁡
              
                (
                
                  
                    T
                    j
                  
                  ||
                  
                    U
                    j
                  
                
                )
              
            
          
        
      
    
    
      
        (
        2
        )
      
    
  




where Tj and Uj denote the target and candidate models corresponding to unit feature tj and uj, respectively. For purposes of explanation, the target cost can be defined based on phonetic and prosodic features (i.e. a phonetic target sub-cost and a prosodic target sub-cost). A schematic diagram of measuring the target cost for a first HMM ti 202 and a second HMM uj 204 with KLD 206 is illustrated in FIG. 3.
Kullback-Leibler Divergence (KLD) is a meaningful statistical measure of the dissimilarity between two probabilistic distributions. If two N-dimensional distributions are respectively assigned to probabilistic or statistical models M and {tilde over (M)} of x (where untilded and tilded variables are related to the target model and its competing model, respectively), KLD between the two models can be calculated as:




  
    
      
        
          
            D
            ⁢
            
              (
            
            ⁢
            M
          
          ||
          
            
              M
              ~
            
            ⁢
            
              )
            
          
        
        =
        
          ∫
          
            
              P
              ⁡
              
                (
                
                  x
                  ❘
                  M
                
                )
              
            
            ⁢
            log
            ⁢
            
              
            
            ⁢
            
              
                P
                ⁡
                
                  (
                  
                    x
                    ❘
                    M
                  
                  )
                
              
              
                
                  P
                  ⁢
                  
                    (
                  
                  ⁢
                  x
                
                ❘
                
                  
                    M
                    ~
                  
                  ⁢
                  
                    )
                  
                
              
            
            ⁢
            
              d
              x
            
          
        
      
    
    
      
        (
        3
        )
      
    
  




However, given two stochastic processes, it is usually cumbersome to calculate their KLD since the random variable sequence can be infinite in length. Although a procedure has been advanced to approximate KLD rate between two HMMs, the KLD rate only measures the similarity between steady-states of two HMMs, while at least with respect to acoustic processing, such as speech processing, the dynamic evolution is of more concern than the steady-states.
KLD between two Gaussian mixtures forms the basis for comparing a pair of acoustic HMM models. In particular, using an unscented transform approach, KLD between two N dimensional Gaussian mixtures




  
    b
    ⁡
    
      (
      o
      )
    
  
  =
  
    
      
        ∑
        
          m
          =
          1
        
        M
      
      ⁢
      
        
          w
          m
        
        ⁢
        
          N
          ⁡
          
            (
            
              
                o
                ;
                
                  μ
                  m
                
              
              ,
              
                Σ
                m
              
            
            )
          
        
        ⁢
        
          
        
        ⁢
        and
        ⁢
        
          
        
        ⁢
        
          
            b
            ~
          
          ⁡
          
            (
            o
            )
          
        
      
    
    =
    
      
        ∑
        
          m
          =
          1
        
        
          M
          ~
        
      
      ⁢
      
        
          w
          m
        
        ⁢
        
          N
          ⁡
          
            (
            
              
                o
                ;
                
                  
                    μ
                    ~
                  
                  m
                
              
              ,
              
                
                  Σ
                  ~
                
                m
              
            
            )
          
        
      
    
  




(where o is the sigma point, w is the kernel weight μ is the mean vector, Σ is the covariance matrix, m is index of M Gaussian kernels) can be approximated by:





  
    
      
        
          D
          ⁢
          
            (
          
          ⁢
          b
        
        ||
        
          
            
              b
              ~
            
            ⁢
            
              )
            
          
          ≈
          
            
              1
              
                2
                ⁢
                N
              
            
            ⁢
            
              
                ∑
                
                  m
                  =
                  1
                
                M
              
              ⁢
              
                
                  w
                  m
                
                ⁢
                
                  
                    ∑
                    
                      k
                      =
                      1
                    
                    
                      2
                      ⁢
                      N
                    
                  
                  ⁢
                  
                    log
                    ⁢
                    
                      
                    
                    ⁢
                    
                      
                        b
                        ⁡
                        
                          (
                          
                            o
                            
                              m
                              ,
                              k
                            
                          
                          )
                        
                      
                      
                        
                          b
                          ~
                        
                        ⁡
                        
                          (
                          
                            o
                            
                              m
                              ,
                              k
                            
                          
                          )
                        
                      
                    
                  
                
              
            
          
        
      
    
    
      
        (
        4
        )
      
    
  




where om,k is the kth sigma point in the mth Gaussian kernel of M Gaussian kernels of b.

Use of the unscented transform is useful in comparing HMM models.
As is known, HMMs for phones can have unequal number of states. In the following, a synchronous state matching method is used to first measure the KLD between two equal-length HMMs, then it is generalized via a dynamic programming algorithm for HMMs of different numbers of states. It should be noted, all the HMMs are considered to have a no skipping, left-to-right topology.
In left-to-right HMMs, dummy end states are only used to indicate the end of the observation, so it is reasonable to endow both of them an identical distribution, as a result, D(bJ∥{tilde over (b)}J)=0. Based on the following decomposition of π (vector of initial probabilities), A (state transition matrix) and d (distance between two states):




  
    π
    =
    
      (
      
        
          π
          ′
        
        0
      
      )
    
  
  ,
  
    
  
  ⁢
  
    A
    =
    
      (
      
        
          
            
              A
              ′
            
          
          
            *
          
        
        
          
            0
          
          
            1
          
        
      
      )
    
  
  ,
  
    
  
  ⁢
  
    d
    =
    
      (
      
        
          d
          ′
        
        0
      
      )
    
  




the following relationship is obtained:




  
    
      π
      T
    
    ⁢
    
      
        ∑
        
          t
          =
          1
        
        τ
      
      ⁢
      
        
          A
          
            t
            -
            1
          
        
        ⁢
        d
      
    
  
  =
  
    
      π
      ′T
    
    ⁢
    
      
        ∑
        
          t
          =
          1
        
        τ
      
      ⁢
      
        
          A
          
            
              ′
              ⁢
              
                
              
              ⁢
              t
            
            -
            1
          
        
        ⁢
        
          d
          ′
        
      
    
  




where T represent transpose, t is time index and τ is the length of observation in terms of time.

By substituting,




  π
  =
  
    
      
        (
        
          
            
              1
            
          
          
            
              0
            
          
          
            
              0
            
          
          
            
              ⋮
            
          
          
            
              0
            
          
          
            
              0
            
          
        
        )
      
      ⁢
      
        
      
      ⁢
      A
    
    =
    
      (
      
        
          
            
              a
              11
            
          
          
            
              a
              12
            
          
          
            0
          
          
            ⋯
          
          
            0
          
          
            0
          
        
        
          
            0
          
          
            
              a
              22
            
          
          
            
              a
              23
            
          
          
            ⋯
          
          
            0
          
          
            0
          
        
        
          
            ⋮
          
          
            ⋮
          
          
            ⋱
          
          
            ⋱
          
          
            ⋮
          
          
            ⋮
          
        
        
          
            0
          
          
            0
          
          
            0
          
          
            ⋱
          
          
            
              a
              
                
                  J
                  -
                  2
                
                ,
                
                  J
                  -
                  1
                
              
            
          
          
            0
          
        
        
          
            0
          
          
            0
          
          
            0
          
          
            ⋯
          
          
            
              a
              
                
                  J
                  -
                  1
                
                ,
                
                  J
                  -
                  1
                
              
            
          
          
            
              a
              
                
                  J
                  -
                  1
                
                ,
                J
              
            
          
        
        
          
            0
          
          
            0
          
          
            0
          
          
            ⋯
          
          
            0
          
          
            1
          
        
      
      )
    
  




an approximation of KLD for symmetric (equal length) HMMs can be represented as:




  
    
      D
      S
    
    ⁢
    
      (
    
    ⁢
    H
  
  ||
  
    
      
        H
        ~
      
      ⁢
      
        )
      
    
    ≤
    
      
        ∑
        
          i
          =
          1
        
        
          J
          -
          1
        
      
      ⁢
      
        Δ
        
          i
          ,
          i
        
      
    
  




where Δi,j represents the symmetric KLD between the ith state in the first HMM and the jth state in the second HMM, and can be represented as:




  
    Δ
    
      i
      ,
      j
    
  
  =
  
    
      
        
          [
          
            
              D
              ⁡
              
                (
                
                  
                    b
                    i
                  
                  ||
                  
                    
                      b
                      ~
                    
                    j
                  
                
                )
              
            
            +
            
              log
              ⁢
              
                
              
              ⁢
              
                
                  a
                  ii
                
                
                  
                    a
                    ~
                  
                  jj
                
              
            
          
          ]
        
        ⁢
        
          l
          i
        
      
      
        }
        
          
            Δ
            ->
          
          
            i
            ,
            j
          
        
      
    
    +
    
      
        
          
            [
            
              
                D
                ⁡
                
                  (
                  
                    
                      
                        b
                        ~
                      
                      j
                    
                    ||
                    
                      b
                      i
                    
                  
                  )
                
              
              +
              
                log
                ⁢
                
                  
                
                ⁢
                
                  
                    
                      a
                      ~
                    
                    jj
                  
                  
                    a
                    ii
                  
                
              
            
            ]
          
          ⁢
          
            
              l
              ~
            
            i
          
        
        }
      
      
        
          Δ
          ←
        
        
          i
          ,
          j
        
      
    
  




where 1i=(1/1−aii) is the average duration of the ith state and the terms {right arrow over (Δ)}i,j and  represents the two asymmetric state KLDs respectively, which can be approximated based on equation (4) above. As illustrated in FIG. 2 and referring to FIG. 3, a method 300 for calculating the total KLD for comparing two HMMs (based on an unscented transform) is to calculate a KLD for each pair of states, state by state, at step 302, and sum the individual state KLD calculations to obtain the total KLD at step 304.
Having described calculation of KLD for equal length HMMs, a more flexible KLD method using Dynamic Programming (DP) will be described to deal with two unequal-length left-to-right HMMs, where J and {tilde over (J)}{tilde over ( )} will be used to denote the state numbers of the first and second HMM, respectively.
In a state-synchronized method as described above and illustrated in FIG. 3, KLD is calculated state by state for each corresponding pair. In order to relax the constraint, a simple case, where a 2-state and a 1-state HMMs with the following transition matrices




  
    A
    =
    
      (
      
        
          
            
              a
              11
            
          
          
            
              1
              -
              
                a
                11
              
            
          
          
            0
          
        
        
          
            0
          
          
            
              a
              22
            
          
          
            
              1
              -
              
                a
                22
              
            
          
        
        
          
            0
          
          
            0
          
          
            1
          
        
      
      )
    
  
  ,
  
    
  
  ⁢
  
    
      A
      ~
    
    =
    
      (
      
        
          
            
              
                a
                ~
              
              11
            
          
          
            
              1
              -
              
                
                  a
                  ~
                
                11
              
            
          
        
        
          
            0
          
          
            1
          
        
      
      )
    
  




will first be compared.

It can be shown that that the upper bound can be represented as

Ds(H∥{tilde over (H)})≦Δ1,1+Δ2,1+φ(ã11,a11,a22)   (5)

where φ(ã11,a11,a22) is a penalty term following the function φ(z,x,y)=(1−z)/(1−x)+(1−z)/(1−y). Although it is to be appreciated that any suitable penalty may be used, including a zero penalty.
Referring to FIG. 7, KLD can be calculated between a 2-state HMM and a 1-state HMM as follows: First, convert 702 the 1-state HMM to a 2-state HMM one by duplicating its state and add a penalty of φ(ã11,a11,a22). Then, calculate 708 and sum 710 up the KLD state pair by state pair using the state-synchronized method described above. As illustrated in FIG. 4, a schematic diagram of state duplication (copy) 402 with a penalty 404 is one form of technique that can be used to create an equal number of states between the HMMs. As illustrated in FIG. 8, the HMM 406 has added state 402 to create two states paired equally with the two states 410 of HMM 408.
It has been discovered that the calculation of KLD between two HMMs can be treated in a manner similar to a generalized string matching process, where state and HMM are counterparts of character and string, respectively. Although various algorithms as is known can be used as is done in string matching, in one embodiment, the basic DP algorithm (Seller, P., “The Theory and Computation of Evolutionary Distances: Pattern Recognition”, Journal of Algorithms. 1: 359-373, 1980) based on edit distance (Levenshtein, V., “Binary Codes Capable of Correcting Spurious Insertions and Deletions of Ones”, Problems of information Transmission, 1:8-17, 1965) can be used. The algorithm is flexible to adaptation in the present application.
In string matching, three kinds of errors are considered: insertion, deletion and substitution. Edit distances caused by all these operations are identical. In KLD calculation, they should be redefined to measure the divergence reasonably. Based on Equation (5) and the atom operation of state copy, generalized edit distances can be defined as:
Generalized substitution distance: If the ith state in the first HMM and the jth state in the second HMM are compared, the substitution distance should be δs(i,j)=Δi,j.
Generalized insertion distance: During DP, if the ith state in the first HMM is treated as a state insertion, three reasonable choices for its competitor in the 2nd HMM can be considered:
(a) Copy the jth state in the second HMM forward as a competitor, then the insertion distance is

δIF(i,j)=Δi−1,j+Δi,j+φ(ãjj,ai−1,i−1,aii)−Δi,j=Δi,j+φ(ãjj,ai−1,i−1,aii).

(b) Copy the j+1th state in the second HMM backward as a competitor, then the insertion distance is

δIB(i,j)=Δi,j+1+Δi+1,j+1+φ(ãj+1,j+1,aii,ai+1,i+1)−Δi+1,j+1=Δi,j+1+φ(ãj+1,j+1,aii,ai+1,i+1).

(c) Incorporate a “non-skippable” short pause (sp) state in the second HMM as a competitor with the ith states in the first HMM, and the insertion distance is defined as δIS(i,j)=Δi,sp. Here the insertion of the sp state is not penalized because it is treated as a modified pronunciation style to have a brief stop in some legal position. It should be noted that the short pause insertion is not always reasonable, for example, it may not appear at any intra-syllable positions. FIG. 5 illustrates each of the foregoing possibilities with the first HMM 500 being compared to a second HMM 502 that may have a state 922 copied forward to state 924, a state 926 copied backward to state 928, or a short pause 930 inserted between states 932 and 934.
Generalized deletion distance: A deletion in the first HMM can be treated as an insertion in the second HMM. So the competitor choices and the corresponding distance are symmetric to those in state insertion:

δDF(i,j)=Δi,j+φ(aii,ãj−1,j−1,ãjj),

δDB(i,j)=Δi+1,j+φ(ai+1,i+1,ãjj,ãj+1,j+1),

δDS(i,j)=Δsp,j.

To deal with the case of HMM boundaries, the following are defined:

Δi,j=∞(i∉[1,J−1] or j∉[1,{tilde over (J)}−1]),

δ(a,ãj−1,j−1,ãjj)=∞(j∉[2,{tilde over (J)}−1]) and

δ(ã,ai−1,i−1,ajj)=∞(i∉[2,J−1])

In view of the foregoing, a general DP algorithm for calculating KLD between two HMMs regardless of whether they are equal in length can be described. This method is illustrated in FIG. 7 at 700. At step 702, if the two HMMs to be compared are of different length, one or both are modified to equalize the number of states. In one embodiment, as indicated at step 704, one or more modifications can be performed at each state from a set of operations comprising Ω={Substitution(S), Forward Insertion (IF), Short pause Insertion (IS), Backward Insertion (IB), Forward Deletion (DF), Short pause Deletion (DS), Backward Deletion (DB)}, where each of the operations of Insertion, Deletion and Substitution have a corresponding penalty for being implemented. At step 706, the operation having the lowest penalty is retained. Steps 704 and 706 are repeated until the HMMs are of the same length.
If desired, during DP at step 704, a J×{tilde over (J)} cost matrix C can be used to save information. Each element Ci,j is an array of {Ci,j,OP}, OPεΩ, where Ci,j,OP means the partially best result when the two HMMs reach their ith and jth states respectively, and the current operation is OP.
FIG. 6 is a schematic diagram of the DP procedure as applied to two left-to-right HMMs, HMM 602, which as “i” states, and HMM 604, which has “j” states. FIG. 6 illustrates all of the basic operations, where the DP procedure begins at node 606 with the total KLD being obtained having reached node 608. In particular, transitions from various states include Substitution(S) indicated by arrow 610; Forward Insertion (IF), Short pause Insertion (IS) and Backward Insertion (IB) all indicated by arrow 612; and Forward Deletion (DF), Short pause Deletion (DS) and Backward Deletion (DB) all indicated by arrow 614.
Saving all or some of the operation related variables may be useful since the current operation depends on the previous one. A “legal” operation matrices listed in table 1 below may be used to direct the DP procedure. The left table is used when sp is incorporated, and the right one is used when it is forbidden.







TABLE 1





Legality of operation pairs













 















For all OPεΩ, elements of cost matrix C can be filled iteratively as follows:




  {
  
    
      
        
          
          ⁢
          
            
              C
              
                0
                ,
                0
                ,
                OP
              
            
            =
            0
          
        
      
    
    
      
        
          
          ⁢
          
            
              
                C
                
                  i
                  ,
                  0
                  ,
                  OP
                
              
              =
              
                
                  
                    min
                    
                      
                        
                          OP
                          1
                        
                        ∈
                        Ω
                      
                      ,
                      
                        
                          (
                          
                            
                              OP
                              1
                            
                            ,
                            OP
                          
                          )
                        
                        ⁢
                        
                          
                        
                        ⁢
                        is
                        ⁢
                        
                          
                        
                        ⁢
                        legal
                      
                    
                  
                  ⁢
                  
                    C
                    
                      
                        i
                        -
                        1
                      
                      ,
                      0
                      ,
                      
                        OP
                        1
                      
                    
                  
                
                +
                
                  
                    δ
                    OP
                  
                  ⁡
                  
                    (
                    
                      i
                      ,
                      0
                    
                    )
                  
                
              
            
            ,
            
              (
              
                0
                <
                i
                ≤
                
                  J
                  -
                  1
                
              
              )
            
          
        
      
    
    
      
        
          
          ⁢
          
            
              
                C
                
                  0
                  ,
                  j
                  ,
                  OP
                
              
              =
              
                
                  
                    min
                    
                      
                        
                          OP
                          1
                        
                        ∈
                        Ω
                      
                      ,
                      
                        
                          (
                          
                            
                              OP
                              1
                            
                            ,
                            OP
                          
                          )
                        
                        ⁢
                        
                          
                        
                        ⁢
                        is
                        ⁢
                        
                          
                        
                        ⁢
                        legal
                      
                    
                  
                  ⁢
                  
                    C
                    
                      0
                      ,
                      
                        j
                        -
                        1
                      
                      ,
                      
                        OP
                        1
                      
                    
                  
                
                +
                
                  
                    δ
                    OP
                  
                  ⁡
                  
                    (
                    
                      0
                      ,
                      j
                    
                    )
                  
                
              
            
            ,
            
              (
              
                0
                <
                j
                ≤
                
                  
                    J
                    _
                  
                  -
                  1
                
              
              )
            
          
        
      
    
    
      
        
          
          ⁢
          
            
              
                C
                
                  i
                  ,
                  j
                  ,
                  OP
                
              
              =
              
                
                  
                    min
                    
                      
                        
                          OP
                          1
                        
                        ∈
                        Ω
                      
                      ,
                      
                        
                          (
                          
                            
                              OP
                              1
                            
                            ,
                            OP
                          
                          )
                        
                        ⁢
                        
                          
                        
                        ⁢
                        is
                        ⁢
                        
                          
                        
                        ⁢
                        legal
                      
                    
                  
                  ⁢
                  
                    C
                    
                      
                        From
                        ⁡
                        
                          (
                          
                            i
                            ,
                            j
                            ,
                            OP
                          
                          )
                        
                      
                      ,
                      
                        OP
                        1
                      
                    
                  
                
                +
                
                  
                    δ
                    OP
                  
                  ⁡
                  
                    (
                    
                      i
                      ,
                      j
                    
                    )
                  
                
              
            
            ,
            
              (
              
                
                  0
                  <
                  i
                  ≤
                  
                    J
                    -
                    1
                  
                
                ,
                
                  0
                  <
                  j
                  ≤
                  
                    
                      J
                      ~
                    
                    -
                    1
                  
                
              
              )
            
          
        
      
    
  
   




where From(i,j,OP) is the previous position given the current position (i,j) and current operation OP, from FIG. 6 it is observed:




  
    From
    ⁡
    
      (
      
        i
        ,
        j
        ,
        OP
      
      )
    
  
  =
  
    {
    
      
        
          
            
            ⁢
            
              
                
                  (
                  
                    
                      i
                      -
                      1
                    
                    ,
                    
                      j
                      -
                      1
                    
                  
                  )
                
                ⁢
                
                  
                
                ⁢
                if
                ⁢
                
                  
                
                ⁢
                OP
              
              =
              S
            
          
        
      
      
        
          
            
            ⁢
            
              
                
                  (
                  
                    
                      i
                      -
                      1
                    
                    ,
                    j
                  
                  )
                
                ⁢
                
                  
                
                ⁢
                if
                ⁢
                
                  
                
                ⁢
                OP
              
              ∈
              
                {
                
                  IF
                  ,
                  IS
                  ,
                  IB
                
                }
              
            
          
        
      
      
        
          
            
            ⁢
            
              
                
                  (
                  
                    i
                    ,
                    
                      j
                      -
                      1
                    
                  
                  )
                
                ⁢
                
                  
                
                ⁢
                if
                ⁢
                
                  
                
                ⁢
                OP
              
              ∈
              
                {
                
                  DF
                  ,
                  DS
                  ,
                  DB
                
                }
              
            
          
        
      
    
  




At the end of the dynamic programming, the KLD approximation can be obtained:




  
    
      D
      S
    
    ⁢
    
      (
    
    ⁢
    H
  
  ||
  
    
      
        H
        ~
      
      ⁢
      
        )
      
    
    ≈
    
      
        min
        
          OP
          ∈
          Ω
        
      
      ⁢
      
        C
        
          
            J
            -
            1
          
          ,
          
            
              J
              _
            
            -
            1
          
          ,
          OP
        
      
    
  




In a further embodiment, another J×{tilde over (J)} matrix B can be used as a counterpart of C at step 706 to save the best previous operations during DP. Based on the matrix, the best state matching path can be extracted by back-tracing from the end position (J−1,J−1)
FIG. 8 shows a demonstration of DP based state matching. In the case of FIG. 8, KLD between the HMMs of syllables “act” (/ae k t/) 802 and “tack” (/t ae k/) 804 are calculated. The two HMMs are equal in length with only slight difference: the tail phoneme in the first syllable is moved to head in the second one. From the figure, it can be seen that the two HMMs are well aligned according to their content, and a quite reasonable KLD value of 788.1 is obtained, while the state-synchronized result is 2529.5. In the demonstration of FIG. 10, KLD between the HMMs of syllables “sting” (/s t ih ng/) 1002 and “string” (/s t r ih ng/) 1004, where a phoneme r is inserted in the latter, are calculated. Because the lengths are unequal now, state synchronized algorithm is helpless, but DP algorithm is also able to match them with outputting a reasonable KLD value of 688.9.
In the state-synchronized algorithm, there is a strong assumption that the two observation sequences jump from one state to the next one synchronously. For two equal-length HMMs, the algorithm is quite effective and efficient. Considering the calculation of Δ as a basic operation, its computational complexity is O(J). This algorithm lays a fundamental basis for the DP algorithm.
In the DP algorithm, the assumption that the two observation sequences jump from one state to the next one synchronously is relaxed. After penalization, the two expanded state sequences corresponding to the best DP path are equal in length, so the state-synchronized algorithm (FIG. 2) can also be used in such case as illustrated by steps 708 and 710 (FIG. 7), which correspond substantially to steps 302 and 304, respectively. However, this algorithm is more effective in dealing with both equal-length HMMs and unequal-length HMMs, but it is less efficient with a computational complexity of O(J×{tilde over (J)}).
FIG. 9 illustrates an example of a suitable computing system environment 900 on which the concepts herein described may be implemented. Nevertheless, the computing system environment 900 is again only one example of a suitable computing environment for each of these computers and is not intended to suggest any limitation as to the scope of use or functionality of the description below. Neither should the computing environment 900 be interpreted as having any dependency or requirement relating to any one or combination of components illustrated in the exemplary operating environment 900.
In addition to the examples herein provided, other well known computing systems, environments, and/or configurations may be suitable for use with concepts herein described. Such systems include, but are not limited to, personal computers, server computers, hand-held or laptop devices, multiprocessor systems, microprocessor-based systems, set top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments that include any of the above systems or devices, and the like.
The concepts herein described may be embodied in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. Those skilled in the art can implement the description and/or figures herein as computer-executable instructions, which can be embodied on any form of computer readable media discussed below.
The concepts herein described may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both locale and remote computer storage media including memory storage devices.
With reference to FIG. 9, an exemplary system includes a general purpose computing device in the form of a computer 910. Components of computer 910 may include, but are not limited to, a processing unit 920, a system memory 930, and a system bus 921 that couples various system components including the system memory to the processing unit 920. The system bus 921 may be any of several types of bus structures including a memory bus or memory controller, a peripheral bus, and a locale bus using any of a variety of bus architectures. By way of example, and not limitation, such architectures include Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MCA) bus, Enhanced ISA (EISA) bus, Video Electronics Standards Association (VESA) locale bus, and Peripheral Component Interconnect (PCI) bus also known as Mezzanine bus.
Computer 910 typically includes a variety of computer readable media. Computer readable media can be any available media that can be accessed by computer 910 and includes both volatile and nonvolatile media, removable and non-removable media. By way of example, and not limitation, computer readable media may comprise computer storage media. Computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can be accessed by computer 900.
The system memory 930 includes computer storage media in the form of volatile and/or nonvolatile memory such as read only memory (ROM) 931 and random access memory (RAM) 932. A basic input/output system 933 (BIOS), containing the basic routines that help to transfer information between elements within computer 910, such as during start-up, is typically stored in ROM 931. RAM 932 typically contains data and/or program modules that are immediately accessible to and/or presently being operated on by processing unit 920. By way of example, and not limitation,
FIG. 9 illustrates operating system 934, application programs 935, other program modules 936, and program data 937. Herein, the application programs 935, program modules 936 and program data 937 implement one or more of the concepts described above.
The computer 910 may also include other removable/non-removable volatile/nonvolatile computer storage media. By way of example only, FIG. 9 illustrates a hard disk drive 941 that reads from or writes to non-removable, nonvolatile magnetic media, a magnetic disk drive 951 that reads from or writes to a removable, nonvolatile magnetic disk 952, and an optical disk drive 955 that reads from or writes to a removable, nonvolatile optical disk 956 such as a CD ROM or other optical media. Other removable/non-removable, volatile/nonvolatile computer storage media that can be used in the exemplary operating environment include, but are not limited to, magnetic tape cassettes, flash memory cards, digital versatile disks, digital video tape, solid state RAM, solid state ROM, and the like. The hard disk drive 941 is typically connected to the system bus 921 through a non-removable memory interface such as interface 940, and magnetic disk drive 951 and optical disk drive 955 are typically connected to the system bus 921 by a removable memory interface, such as interface 950.
The drives and their associated computer storage media discussed above and illustrated in FIG. 9, provide storage of computer readable instructions, data structures, program modules and other data for the computer 910. In FIG. 9, for example, hard disk drive 941 is illustrated as storing operating system 944, application programs 945, other program modules 946, and program data 947. Note that these components can either be the same as or different from operating system 934, application programs 935, other program modules 936, and program data 937. Operating system 944, application programs 945, other program modules 946, and program data 947 are given different numbers here to illustrate that, at a minimum, they are different copies.
A user may enter commands and information into the computer 910 through input devices such as a keyboard 962, a microphone 963, and a pointing device 961, such as a mouse, trackball or touch pad. These and other input devices are often connected to the processing unit 920 through a user input interface 960 that is coupled to the system bus, but may be connected by other interface and bus structures, such as a parallel port or a universal serial bus (USB). A monitor 991 or other type of display device is also connected to the system bus 921 via an interface, such as a video interface 990.
The computer 910 may operate in a networked environment using logical connections to one or more remote computers, such as a remote computer 980. The remote computer 980 may be a personal computer, a hand-held device, a server, a router, a network PC, a peer device or other common network node, and typically includes many or all of the elements described above relative to the computer 910. The logical connections depicted in FIG. 9 include a locale area network (LAN) 971 and a wide area network (WAN) 973, but may also include other networks. Such networking environments are commonplace in offices, enterprise-wide computer networks, intranets and the Internet.
When used in a LAN networking environment, the computer 910 is connected to the LAN 971 through a network interface or adapter 970. When used in a WAN networking environment, the computer 910 typically includes a modem 972 or other means for establishing communications over the WAN 973, such as the Internet. The modem 972, which may be internal or external, may be connected to the system bus 921 via the user-input interface 960, or other appropriate mechanism. In a networked environment, program modules depicted relative to the computer 910, or portions thereof, may be stored in the remote memory storage device. By way of example, and not limitation, FIG. 9 illustrates remote application programs 985 as residing on remote computer 980. It will be appreciated that the network connections shown are exemplary and other means of establishing a communications link between the computers may be used.
It should be noted that the concepts herein described can be carried out on a computer system such as that described with respect to FIG. 9. However, other suitable systems include a server, a computer devoted to message handling, or on a distributed system in which different portions of the concepts are carried out on different parts of the distributed computing system.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not limited to the specific features or acts described above as has been held by the courts. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.

## Claims

1. A computer-implemented method for measuring the total Kullback-Leibler Divergence (KLD) of two hidden Markov models (HMM), the two HMMs including a first HMM having a first number of states and a second HMM having a second, different number of states, the method comprising:
modifying both the first number of states in the first HMM and the second number of states in the second HMM to equalize the first number and the second number of states, wherein modifying includes performing a series of operations relative to a plurality of states of the first HMM and the second HMM comprising:
for each of the plurality of states, identifying penalty values associated with one or more possible modification operations relative to the state, the one or more possible modification operations being taken from a set of modification operations including deleting a state of at least one of the HMMs and substituting a state of at least one of the HMMs;
selecting one or more of the possible modification operations that equalizes the number of states of the two HMMs and minimizes a total of the penalty values; and
performing the one or more selected modification operations to equalize the number of states of the two HMMs;

after modifying the first and the second HMMs to equalize the number of states, calculating an individual KLD for each pair of states, state by state, for the two HMMs, using a processor of a computer;
summing the individual KLDs together to obtain a total KLD for the two HMMs; and
outputting the total KLD.

2. The method of claim 1 wherein the step of modifying includes assigning an associated penalty value to the modification.

3. The method of claim 2 wherein the step of modifying includes modifying at least one of the HMMs in a manner to minimize the penalty value.

4. The method of claim 1 wherein modifying includes inserting a state in one of the HMM models.

5. The method of claim 1 wherein modifying includes deleting a state in one of the HMM models.

6. The method of claim 1 wherein modifying includes substituting a state for one of the states in one of the HMM models.

7. The method of claim 1 wherein modifying includes inserting a non-skippable short pause (sp) state in one of the HMM models.

8. A computer readable medium having instructions which when executed by a computer perform a method for measuring the total Kullback-Leibler Divergence (KLD) of two hidden Markov models (HMM), the two HMMs including a first HMM having a first number of states and a second HMM having a second, different number of states, the method comprising:
modifying at least one of the HMMs to equalize the first number of states and the second number of states, wherein modifying includes performing a series of operations to at least one of the HMMs, the operations including duplicating a state of one of the first and the second HMMs such that the HMM of the one of the first and the second HMMs includes the state and a copy of the state;
calculating an individual KLD using a processor of the computer for each pair of states, state by state, for the two HMMs; and
summing the individual KLDs together to obtain a total KLD for the two HMMs.

9. The computer readable medium of claim 8 wherein the step of modifying includes assigning an associated penalty value to the modification.

10. The computer readable medium of claim 9 wherein the step of modifying includes modifying at least one of the HMMs in a manner to minimize the penalty value.

11. The computer readable medium of claim 10 wherein the operations further include inserting a state in one of the HMM models.

12. The computer readable medium of claim 10 wherein the operations further include deleting a state in one of the HMM models.

13. The computer readable medium of claim 10 wherein the operations further include substituting a state for one of the states in one of the HMM models.

14. The computer readable medium of claim 10 wherein the operations further include inserting a non-skippable short pause (sp) state in one of the HMM models.

15. A system for comparing a pair of acoustic hidden Markov models (HMMs), the system comprising:
a first acoustic hidden Markov model (HMM) having a first number of states;
a second acoustic HMM having a second number of states, the second number being different than the first number; and
a KLD (Kullback-Leibler Divergence) calculating module configured to:
receive the first and second acoustic HMMs;
modify at least one of the first and second acoustic HMMs to equalize the first and second number of states, wherein the KLD calculating module is configured to, for each of the first and second number of states, calculate penalty values for possible state modification operations, wherein the KLD calculating module is configured to select and perform one or more of the possible state modification operations that both equalizes the number of states of the first and second acoustic HMMs and minimizes a total of the penalty values, wherein one of the one or more possible state modification operations includes duplicating a state of one of the first and the second acoustic HMMs such that the HMM of the one of the first and the second acoustic HMMs includes the state and a copy of the state;
calculate the KLD between the first and second acoustic HMMs using a processor of a computer by calculating the KLD from individual KLDs for each pair of states, state by state, for the first and second acoustic HMMs, the KLD calculating module further configured to provide as an output at least one of the calculated KLD and information related to sorting of the first and second acoustic HMMs.

16. The system of claim 15 and further comprising an application processing module configured to receive the output and perform a task related to processing speech units.