[mlpack-git] master: Minor bug fixes in Gradient Descent module (76198fe)
gitdub at mlpack.org
gitdub at mlpack.org
Thu Sep 29 17:14:52 EDT 2016
Repository : https://github.com/mlpack/mlpack
On branch : master
Link : https://github.com/mlpack/mlpack/compare/998bb2fae41210d03ddf007b51d994a9cf6262cf...5fd539549c181e602e48c18fd9c024382c42d676
>---------------------------------------------------------------
commit 76198fe222723cadb3d1882bc8b061b4358c924e
Author: sumedhghaisas <sumedhghaisas at gmail.com>
Date: Fri Sep 30 02:44:52 2016 +0530
Minor bug fixes in Gradient Descent module
>---------------------------------------------------------------
76198fe222723cadb3d1882bc8b061b4358c924e
.../optimizers/gradient_descent/gradient_descent_impl.hpp | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/mlpack/core/optimizers/gradient_descent/gradient_descent_impl.hpp b/src/mlpack/core/optimizers/gradient_descent/gradient_descent_impl.hpp
index 9f17b09..564fcdd 100644
--- a/src/mlpack/core/optimizers/gradient_descent/gradient_descent_impl.hpp
+++ b/src/mlpack/core/optimizers/gradient_descent/gradient_descent_impl.hpp
@@ -35,25 +35,25 @@ double GradientDescent<FunctionType>::Optimize(
double lastObjective = DBL_MAX;
// Now iterate!
- arma::vec gradient(iterate.n_cols);
+ arma::mat gradient(iterate.n_cols);
for (size_t i = 1; i != maxIterations; ++i)
{
// Output current objective function.
Log::Info << "Gradient Descent: iteration " << i << ", objective "
- << overallObjective << "." << std::endl;
+ << overallObjective << "." << std::endl;
if (std::isnan(overallObjective) || std::isinf(overallObjective))
{
Log::Warn << "Gradient Descent: converged to " << overallObjective
- << "; terminating" << " with failure. Try a smaller step size?"
- << std::endl;
+ << "; terminating" << " with failure. Try a smaller step size?"
+ << std::endl;
return overallObjective;
}
if (std::abs(lastObjective - overallObjective) < tolerance)
{
Log::Info << "Gradient Descent: minimized within tolerance "
- << tolerance << "; " << "terminating optimization." << std::endl;
+ << tolerance << "; " << "terminating optimization." << std::endl;
return overallObjective;
}
@@ -70,7 +70,7 @@ double GradientDescent<FunctionType>::Optimize(
}
Log::Info << "Gradient Descent: maximum iterations (" << maxIterations
- << ") reached; " << "terminating optimization." << std::endl;
+ << ") reached; " << "terminating optimization." << std::endl;
return overallObjective;
}
More information about the mlpack-git
mailing list