[mlpack-git] [mlpack] How to speed up HMM training ? (#550)

Ryan Curtin notifications at github.com
Fri Mar 4 11:10:42 EST 2016


Have you compiled mlpack without debugging symbols?  If you're using the git master branch, then debugging and profiling symbols are enabled by default (you can disable with `-DDEBUG=OFF -DPROFILE=OFF`), and if you're using a release (2.0.1, for instance), then debugging and profiling symbols are disabled by default so that should not be an issue.  And I assume you're compiling your program with `-O3` and without any debugging symbols or anything.

The EM algorithm may take some time to converge for a GMM.  I think maybe to figure out what is going on here, you should try removing the HMM layer and just train a GMM on its own on the data.  When you call `GMM::Train()`, you can pass in an instantiated `EMFit` object so that you can set the options, like the maximum number of iterations and the tolerance.

Based on your profile it seems like the major delay is possibly in these lines from `em_fit_impl.hpp` (lines 88--93):

```
// Calculate the new value of the covariances using the updated
// conditional probabilities and the updated means.
arma::mat tmp = observations - (dists[i].Mean() *
    arma::ones<arma::rowvec>(observations.n_cols));
arma::mat tmpB = tmp % (arma::ones<arma::vec>(observations.n_rows) *
    trans(condProb.col(i)));
```

I wonder if that expression is not being optimized well?

---
Reply to this email directly or view it on GitHub:
https://github.com/mlpack/mlpack/issues/550#issuecomment-192337638
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160304/4bab4746/attachment.html>


More information about the mlpack-git mailing list