From d0d1e59fbb093e7f4162f2ed6997ad710a5affff Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Wed, 4 Oct 2017 21:34:58 -0400 Subject: [PATCH] The gradient is accumulated, so there is no need to take multiple steps. --- src/mlpack/core/optimizers/sgd/sgd_impl.hpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/mlpack/core/optimizers/sgd/sgd_impl.hpp b/src/mlpack/core/optimizers/sgd/sgd_impl.hpp index 7396874bb4..41dc744c56 100644 --- a/src/mlpack/core/optimizers/sgd/sgd_impl.hpp +++ b/src/mlpack/core/optimizers/sgd/sgd_impl.hpp @@ -110,8 +110,7 @@ double SGD::Optimize( function.Gradient(iterate, currentFunction, gradient, effectiveBatchSize); // Use the update policy to take a step. - for (size_t k = 0; k < effectiveBatchSize; ++k) // hack... - updatePolicy.Update(iterate, stepSize, gradient); + updatePolicy.Update(iterate, stepSize, gradient); overallObjective += function.Evaluate(iterate, currentFunction, effectiveBatchSize);