[mlpack-git] master: fix HMM load/save tests by ensuring covariance is positive definite (cbdfab5)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Mon Jan 26 15:26:48 EST 2015


Repository : https://github.com/mlpack/mlpack

On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/71a9f87ab29175554507f1592e564063f0452743...9b55e5e4a300972d01cf1cf2802df8bf392a1fd1

>---------------------------------------------------------------

commit cbdfab57a0ce0ab1549bbc11b94406f1f1f14b3e
Author: Stephen Tu <stephent at berkeley.edu>
Date:   Tue Jan 20 17:19:17 2015 -0800

    fix HMM load/save tests by ensuring covariance is positive definite


>---------------------------------------------------------------

cbdfab57a0ce0ab1549bbc11b94406f1f1f14b3e
 src/mlpack/tests/hmm_test.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/mlpack/tests/hmm_test.cpp b/src/mlpack/tests/hmm_test.cpp
index 9ae7016..6ec90b2 100644
--- a/src/mlpack/tests/hmm_test.cpp
+++ b/src/mlpack/tests/hmm_test.cpp
@@ -995,6 +995,8 @@ BOOST_AUTO_TEST_CASE(GMMHMMLoadSaveTest)
       arma::mat covariance = arma::randu<arma::mat>(
           hmm.Emission()[j].Component(i).Covariance().n_rows,
           hmm.Emission()[j].Component(i).Covariance().n_cols);
+      covariance *= covariance.t();
+      covariance += arma::eye<arma::mat>(covariance.n_rows, covariance.n_cols);
       hmm.Emission()[j].Component(i).Covariance(std::move(covariance));
     }
   }
@@ -1054,6 +1056,8 @@ BOOST_AUTO_TEST_CASE(GaussianHMMLoadSaveTest)
     arma::mat covariance = arma::randu<arma::mat>(
         hmm.Emission()[j].Covariance().n_rows,
         hmm.Emission()[j].Covariance().n_cols);
+    covariance *= covariance.t();
+    covariance += arma::eye<arma::mat>(covariance.n_rows, covariance.n_cols);
     hmm.Emission()[j].Covariance(std::move(covariance));
   }
 



More information about the mlpack-git mailing list