[mlpack-svn] r12431 - mlpack/trunk/src/mlpack/methods/gmm

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Tue Apr 17 11:13:52 EDT 2012


Author: rcurtin
Date: 2012-04-17 11:13:52 -0400 (Tue, 17 Apr 2012)
New Revision: 12431

Modified:
   mlpack/trunk/src/mlpack/methods/gmm/gmm.hpp
Log:
Take care of FittingType when we are passing in means, covariances, and weights
to build a GMM.


Modified: mlpack/trunk/src/mlpack/methods/gmm/gmm.hpp
===================================================================
--- mlpack/trunk/src/mlpack/methods/gmm/gmm.hpp	2012-04-17 14:47:10 UTC (rev 12430)
+++ mlpack/trunk/src/mlpack/methods/gmm/gmm.hpp	2012-04-17 15:13:52 UTC (rev 12431)
@@ -152,9 +152,31 @@
       dimensionality((!means.empty()) ? means[0].n_elem : 0),
       means(means),
       covariances(covariances),
-      weights(weights) { /* nothing to do */ }
+      weights(weights),
+      localFitter(FittingType()),
+      fitter(localFitter) { /* Nothing to do. */ }
 
   /**
+   * Create a GMM with the given means, covariances, and weights, and use the
+   * given initialized FittingType class.  This is useful in cases where the
+   * FittingType class needs to store some state.
+   *
+   * @param means Means of the model.
+   * @param covariances Covariances of the model.
+   * @param weights Weights of the model.
+   */
+  GMM(const std::vector<arma::vec>& means,
+      const std::vector<arma::mat>& covariances,
+      const arma::vec& weights,
+      FittingType& fitter) :
+      gaussians(means.size()),
+      dimensionality((!means.empty()) ? means[0].n_elem : 0),
+      means(means),
+      covariances(covariances),
+      weights(weights),
+      fitter(fitter) { /* Nothing to do. */ }
+
+  /**
    * Copy constructor for GMMs which use different fitting types.
    */
   template<typename OtherFittingType>




More information about the mlpack-svn mailing list