[mlpack-git] master,mlpack-1.0.x: Added ToString to GMM (7807955)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Thu Mar 5 21:41:52 EST 2015


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

On branches: master,mlpack-1.0.x
Link       : https://github.com/mlpack/mlpack/compare/904762495c039e345beba14c1142fd719b3bd50e...f94823c800ad6f7266995c700b1b630d5ffdcf40

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

commit 780795510b141ba48357594bba50f0e7c5145ff6
Author: birm <birm at gatech.edu>
Date:   Tue Feb 4 22:02:27 2014 +0000

    Added ToString to GMM


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

780795510b141ba48357594bba50f0e7c5145ff6
 src/mlpack/methods/gmm/gmm.hpp      | 6 ++++++
 src/mlpack/methods/gmm/gmm_impl.hpp | 9 +++++++++
 2 files changed, 15 insertions(+)

diff --git a/src/mlpack/methods/gmm/gmm.hpp b/src/mlpack/methods/gmm/gmm.hpp
index 590c88f..15341d1 100644
--- a/src/mlpack/methods/gmm/gmm.hpp
+++ b/src/mlpack/methods/gmm/gmm.hpp
@@ -334,6 +334,11 @@ class GMM
   void Classify(const arma::mat& observations,
                 arma::Col<size_t>& labels) const;
 
+  /**
+   * Returns a string representation of this object.
+   */
+  std::string ToString() const;
+
  private:
   /**
    * This function computes the loglikelihood of the given model.  This function
@@ -363,3 +368,4 @@ class GMM
 #include "gmm_impl.hpp"
 
 #endif
+
diff --git a/src/mlpack/methods/gmm/gmm_impl.hpp b/src/mlpack/methods/gmm/gmm_impl.hpp
index 6daa2c2..f5d1c95 100644
--- a/src/mlpack/methods/gmm/gmm_impl.hpp
+++ b/src/mlpack/methods/gmm/gmm_impl.hpp
@@ -476,7 +476,16 @@ double GMM<FittingType>::LogLikelihood(
   return loglikelihood;
 }
 
+template<typename FittingType>
+std::string GMM<FittingType>::ToString() const
+{
+  std::ostringstream convert;
+  convert << "GMM [" << this << "]" << std::endl;
+  return convert.str();
+}
+
 }; // namespace gmm
 }; // namespace mlpack
 
 #endif
+



More information about the mlpack-git mailing list