[mlpack-svn] r16174 - mlpack/trunk/src/mlpack/core/optimizers/sgd
fastlab-svn at coffeetalk-1.cc.gatech.edu
fastlab-svn at coffeetalk-1.cc.gatech.edu
Tue Jan 28 14:11:45 EST 2014
Author: birm
Date: Tue Jan 28 14:11:45 2014
New Revision: 16174
Log:
Added Tostring to SGD.
Modified:
mlpack/trunk/src/mlpack/core/optimizers/sgd/sgd.hpp
mlpack/trunk/src/mlpack/core/optimizers/sgd/sgd_impl.hpp
Modified: mlpack/trunk/src/mlpack/core/optimizers/sgd/sgd.hpp
==============================================================================
--- mlpack/trunk/src/mlpack/core/optimizers/sgd/sgd.hpp (original)
+++ mlpack/trunk/src/mlpack/core/optimizers/sgd/sgd.hpp Tue Jan 28 14:11:45 2014
@@ -121,6 +121,9 @@
//! Modify whether or not the individual functions are shuffled.
bool& Shuffle() { return shuffle; }
+ // convert the obkect into a string
+ std::string ToString() const;
+
private:
//! The instantiated function.
DecomposableFunctionType& function;
Modified: mlpack/trunk/src/mlpack/core/optimizers/sgd/sgd_impl.hpp
==============================================================================
--- mlpack/trunk/src/mlpack/core/optimizers/sgd/sgd_impl.hpp (original)
+++ mlpack/trunk/src/mlpack/core/optimizers/sgd/sgd_impl.hpp Tue Jan 28 14:11:45 2014
@@ -97,6 +97,20 @@
return overallObjective;
}
+//Convert the Object to a String
+template<typename DecomposableFunctionType>
+std::string SGD<DecomposableFunctionType>::ToString() const{
+ std::ostringstream convert;
+ convert << "SGD [" << this << "]" << std::endl;
+ // Fix this! Why Only log? Ostream is lonely.
+ Log::Debug << "Function: " << function << std::endl;
+ convert << "StepSize: " << stepSize << std::endl;
+ convert << "Maximum Iterations: " << maxIterations << std::endl;
+ convert << "Tolerance: " << tolerance << std::endl;
+ convert << "Shuffle: " << shuffle << std::endl;
+ return convert.str();
+}
+
}; // namespace optimization
}; // namespace mlpack
More information about the mlpack-svn
mailing list