[mlpack-svn] r16179 - mlpack/trunk/src/mlpack/core/optimizers/lbfgs
fastlab-svn at coffeetalk-1.cc.gatech.edu
fastlab-svn at coffeetalk-1.cc.gatech.edu
Tue Jan 28 14:45:14 EST 2014
Author: birm
Date: Tue Jan 28 14:45:14 2014
New Revision: 16179
Log:
Added ToString to LBFGS
Modified:
mlpack/trunk/src/mlpack/core/optimizers/lbfgs/lbfgs.hpp
mlpack/trunk/src/mlpack/core/optimizers/lbfgs/lbfgs_impl.hpp
Modified: mlpack/trunk/src/mlpack/core/optimizers/lbfgs/lbfgs.hpp
==============================================================================
--- mlpack/trunk/src/mlpack/core/optimizers/lbfgs/lbfgs.hpp (original)
+++ mlpack/trunk/src/mlpack/core/optimizers/lbfgs/lbfgs.hpp Tue Jan 28 14:45:14 2014
@@ -139,6 +139,9 @@
//! Modify the maximum line search step size.
double& MaxStep() { return maxStep; }
+ // convert the obkect into a string
+ std::string ToString() const;
+
private:
//! Internal reference to the function we are optimizing.
FunctionType& function;
@@ -251,3 +254,4 @@
#include "lbfgs_impl.hpp"
#endif // __MLPACK_CORE_OPTIMIZERS_LBFGS_LBFGS_HPP
+
Modified: mlpack/trunk/src/mlpack/core/optimizers/lbfgs/lbfgs_impl.hpp
==============================================================================
--- mlpack/trunk/src/mlpack/core/optimizers/lbfgs/lbfgs_impl.hpp (original)
+++ mlpack/trunk/src/mlpack/core/optimizers/lbfgs/lbfgs_impl.hpp Tue Jan 28 14:45:14 2014
@@ -419,7 +419,26 @@
return function.Evaluate(iterate);
}
+
+// convert the object to a string
+template<typename FunctionType>
+std::string L_BFGS<FunctionType>::ToString() const{
+ std::ostringstream convert;
+ convert << "L_BFGS [" << this << "]" << std::endl;
+ convert << "Memory Size: " << numBasis << std::endl;
+ convert << "Cube Size" << s.n_rows << "x" << s.n_cols << "x" << s.n_slices;
+ convert << std::endl;
+ convert << "Maximum Iterations: " << maxIterations << std::endl;
+ convert << "Armijo condition Parameter: " << armijoConstant << std::endl;
+ convert << "Wolfe Parameter: " << wolfe << std::endl;
+ convert << "Minimum Gradient: " << minGradientNorm << std::endl;
+ convert << "Minimum Step of Line Search: " << minStep << std::endl;
+ convert << "Maximum Step of Line Search: " << maxStep << std::endl;
+ return convert.str();
+}
+
}; // namespace optimization
}; // namespace mlpack
#endif // __MLPACK_CORE_OPTIMIZERS_LBFGS_LBFGS_IMPL_HPP
+
More information about the mlpack-svn
mailing list