# MFCCs and MoG-HMMs for speech recognition

BACKGROUND

MFCCs are coefficients which represent the most important parts of speech, and about 12 of them are used to model a one 512 points long frame (of speech). Along with them you would use delta coeffients, which track the change of MFCCs over time (adjecent frames).

I want to use these feature vectors (dimensions 12+12=24) as data for a speech recognizer, which is based on a Hidden Markov Model, whose states are mixtures of Gaussians.I will use training data to re-estimate parameters of a HMM, such as:

transition matrix $A$,

starting state probabilities $\pi$,

weights for each of the mixtures inside a state $c_{jk}$ (jth state, kth mixture),

means of the mixtures $\mu_{jk}$

covariances of the mixtures $\Sigma_{jk}$

I'm using Baum–Welch algorithm to do this.

PROBLEM

I have found two suitable libraries online for the re-estimation, but when I feed them my data, one sequence (audio file of a particular keyword), they complete very quickly and when I try to get log-probabilities they return positive values. But, one algorithm has informed me immediately that during an iteration, when it's time to update a particular covariance matrix, on the nth line I have a badly scaled or a singular matrix. When I look at that line I see that it's doing an inverse of a $\Sigma_{jk}$, which is defined as $\Sigma_{jk} = \frac{\sum\limits_{t=1}^T\gamma_t(j,k) (o_t - \mu_j)(o_t - \mu_j)'}{\sum\limits_{t=1}^T \gamma_t(j,k)}$

After seome tinkering with the MFCCs and deltas, this other implementation of BM algorithm tells me that I am dividing by 0 when assigning new covariances (step above).

Gammas are obtained from:

$\gamma_t(j,k) = \frac{\alpha_t(j)\beta_t(j)}{\sum\limits_{j=1}^N\alpha_t(j)\beta_t(j)} \frac{c_{jk}\mathcal{N}(o_t, \mu_{jk}, \Sigma_{j,k})}{\sum\limits_{k=1}^M c_{jk}\mathcal{N}(o_t, \mu_{jk}, \Sigma_{j,k})}$

Can someone more experienced in data science see what is wrong with gamma? I have tried normalazing feature vectors, but it did not help. Below I will list how I have calculated MFCCs, in case it is of help.

MFCC CALCULATION

No noise cancelling (audio is quite clear), no windows functions, frames overlap by 50%.

I find the FFT of a 512 long sample. Then I find its absolute value.

There are 26 filters in the filterbank, I dot product every one of them with the previously found absolute value, and I get 26 mel cepstrum coefficients.

Then I do the DCT2 on these coefficients and I keep 12 of them, 2-13

Delta coefficients are calculated: $d_t=\frac{\sum\limits_{n=1}^N n(c_{t+n} - c_{t-n})}{2\sum\limits_{n=1}^Nn^2}$

Help is appreciated. Here is the work I have used as a guide.

$-\frac{1}{2}(o_t - \mu_{jk})^T\Sigma_{jk}(o_t-\mu_{jk})$