<p>Just a quick update: I've been looking into this, and I found a random seed that allows me to reproduce the issue, but when I use a debugger to step through the calculations to find out where the NaN is coming from, the results don't make any sense.  If I print the value with cout, it gives me something different than what I get if I don't print it and use gdb to inspect.  I'm digging deeper, but I don't have anything yet...</p>

<p>It does appear that this occurs because the covariance matrices for individual Gaussians are getting very small.  I think with your dataset this happens in part because there are so many points with the exact same values.  I know this isn't a solution, but I suspect that if you were to add noise to each point (maybe Gaussian noise with standard deviation 1e-15 or something else quite small), you might encounter fewer or no crashes like this.</p>

<p>I'll keep looking and let you know when I get to the bottom of this. :)</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-172860010">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFH73Rz81RzJM9DdF51wgbUEIGoIDks5pbjc3gaJpZM4G1xqM.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-172860010"></link>
  <meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>