<p>Hi there,</p>

<p>Sorry for the slow response.  It took me a while to dig into this one.  I believe that what was happening here was that some particular Gaussian from one of the GMMs that make up your HMM emission distribution had a covariance matrix which wasn't positive definite (or, positive definite enough for chol()).  Previously, this issue had been handled by the file <code>src/mlpack/methods/gmm/positive_definite_constraint.hpp</code> [1], which, at the end of each EM algorithm iteration during GMM training, would add small amounts to the diagonal until the determinant was greater than 0 (and thus the matrix would be positive definite).</p>

<p>However, what seemed to actually be occurring was that the determinant was indeed greater than 0, but because of floating point errors (I theorize) the call to <code>arma::chol()</code> would fail.  So, in <a href="https://github.com/mlpack/mlpack/commit/e08a8ff534e2c8c153007c51bc55a5e0ac69c9a6" class="commit-link"><tt>e08a8ff</tt></a> I committed a better strategy for checking positive definiteness: instead of using <code>arma::det()</code> and forcing the determinant to be greater than some small value like 1e-50, we just call <code>arma::chol()</code> to make sure it converges, and if not, add to the diagonal.  This guarantees that when the <code>PositiveDefiniteConstraint</code> is applied, the covariance matrix can be decomposed with <code>arma::chol()</code>, and therefore the problem you're having, you shouldn't have anymore (assuming you update to git master).</p>

<p>As a side note, I am about to rename all of the executables to be prefixed with <code>mlpack_</code>, so <code>hmm_train</code> will become <code>mlpack_hmm_train</code>, as per <a href="https://github.com/mlpack/mlpack/issues/229" class="issue-link js-issue-link" data-url="https://github.com/mlpack/mlpack/issues/229" data-id="53036785" data-error-text="Failed to load issue title" data-permission-text="Issue title is private">#229</a>, in the next couple days or so, so if you update and rebuild mlpack, you may notice that the names have changed.  But no compatibility breakage or anything, so there shouldn't be any issues -- just giving you a heads up. :)</p>

<p>If my big long explanation turns out to have been wrong or my fix didn't actually fix your issue, feel free to reopen... (I really hope it is a fix, though, it took me a while to dig to the bottom of that one.) :)</p>

<p>[1] <a href="https://github.com/mlpack/mlpack/blob/master/src/mlpack/methods/gmm/positive_definite_constraint.hpp">https://github.com/mlpack/mlpack/blob/master/src/mlpack/methods/gmm/positive_definite_constraint.hpp</a></p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br>Reply to this email directly or <a href="https://github.com/mlpack/mlpack/issues/496#issuecomment-165892114">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFFag6FqT9Ky7kaewI9dbIICVV0sdks5pRGUCgaJpZM4G1xqM.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/mlpack/mlpack/issues/496#issuecomment-165892114"></link>
  <meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>