[mlpack-svn] r16175 - mlpack/trunk/src/mlpack/methods/nca

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Tue Jan 28 14:12:39 EST 2014


Author: birm
Date: Tue Jan 28 14:12:39 2014
New Revision: 16175

Log:
Addes Tostring here early, mostly because SGD required it.


Modified:
   mlpack/trunk/src/mlpack/methods/nca/nca_softmax_error_function.hpp
   mlpack/trunk/src/mlpack/methods/nca/nca_softmax_error_function_impl.hpp

Modified: mlpack/trunk/src/mlpack/methods/nca/nca_softmax_error_function.hpp
==============================================================================
--- mlpack/trunk/src/mlpack/methods/nca/nca_softmax_error_function.hpp	(original)
+++ mlpack/trunk/src/mlpack/methods/nca/nca_softmax_error_function.hpp	Tue Jan 28 14:12:39 2014
@@ -108,6 +108,9 @@
    */
   size_t NumFunctions() const { return dataset.n_cols; }
 
+  // convert the obkect into a string
+  std::string ToString() const;
+
  private:
   //! The dataset.
   const arma::mat& dataset;

Modified: mlpack/trunk/src/mlpack/methods/nca/nca_softmax_error_function_impl.hpp
==============================================================================
--- mlpack/trunk/src/mlpack/methods/nca/nca_softmax_error_function_impl.hpp	(original)
+++ mlpack/trunk/src/mlpack/methods/nca/nca_softmax_error_function_impl.hpp	Tue Jan 28 14:12:39 2014
@@ -267,6 +267,18 @@
   precalculated = true;
 }
 
+template<typename MetricType>
+std::string SoftmaxErrorFunction<MetricType>::ToString() const{
+  std::ostringstream convert;
+  convert << "Sofmax Error Function [" << this << "]" << std::endl;
+  convert << "Dataset: " << dataset.n_rows << "x" << dataset.n_cols 
+      << std::endl;
+  convert << "Labels: " << labels.n_elem << std::endl;
+  //convert << "Metric: " << metric << std::endl;
+  convert << "Precalculated: " << precalculated << std::endl;
+  return convert.str();
+}
+
 }; // namespace nca
 }; // namespace mlpack
 



More information about the mlpack-svn mailing list