[mlpack-git] [mlpack/mlpack] Implemeted gradient descent optimizer. (#792)

Ryan Curtin notifications at github.com
Wed Sep 28 22:04:41 EDT 2016

rcurtin commented on this pull request.

> +    stepSize(stepSize),
+    maxIterations(maxIterations),
+    tolerance(tolerance)
+{ /* Nothing to do. */ }
+//! Optimize the function (minimize).
+template<typename FunctionType>
+double GradientDescent<FunctionType>::Optimize(
+    arma::mat& iterate)
+  // To keep track of where we are and how things are going.
+  double overallObjective = function.Evaluate(iterate);
+  double lastObjective = DBL_MAX;
+  // Now iterate!
+  arma::vec gradient(iterate.n_cols);

This should be `arma::mat` not `arma::vec`, and you should use both the number of rows and columns to initialize it.  Otherwise it will fail if we use an objective function that uses a 2-d matrix instead of a 1-d vector.

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160928/23f55a03/attachment-0001.html>

More information about the mlpack-git mailing list