[mlpack-git] master: Handle case when dataSeq.size() == 1. Thanks warpuv for pointing this out! (e0e7ba5)

gitdub at mlpack.org gitdub at mlpack.org
Wed Apr 13 10:52:19 EDT 2016


Repository : https://github.com/mlpack/mlpack
On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/1417d45d7ca3d64892291d80296479dadf69f7af...e0e7ba5353e5377b7ed87d5c364c0a7d446d737c

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

commit e0e7ba5353e5377b7ed87d5c364c0a7d446d737c
Author: Ryan Curtin <ryan at ratml.org>
Date:   Wed Apr 13 10:52:19 2016 -0400

    Handle case when dataSeq.size() == 1.
    Thanks warpuv for pointing this out!


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

e0e7ba5353e5377b7ed87d5c364c0a7d446d737c
 src/mlpack/methods/hmm/hmm_impl.hpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/mlpack/methods/hmm/hmm_impl.hpp b/src/mlpack/methods/hmm/hmm_impl.hpp
index 1d005f0..9ea038a 100644
--- a/src/mlpack/methods/hmm/hmm_impl.hpp
+++ b/src/mlpack/methods/hmm/hmm_impl.hpp
@@ -162,6 +162,8 @@ void HMM<Distribution>::Train(const std::vector<arma::mat>& dataSeq)
     // Normalize the new initial probabilities.
     if (dataSeq.size() > 1)
       initial = newInitial / dataSeq.size();
+    else
+      initial = newInitial;
 
     // Assign the new transition matrix.  We use %= (element-wise
     // multiplication) because every element of the new transition matrix must




More information about the mlpack-git mailing list