12 #ifndef MLPACK_CORE_OPTIMIZERS_GRADIENT_DESCENT_GRADIENT_DESCENT_HPP
13 #define MLPACK_CORE_OPTIMIZERS_GRADIENT_DESCENT_GRADIENT_DESCENT_HPP
18 namespace optimization {
52 template<
typename FunctionType>
69 const double stepSize = 0.01,
70 const size_t maxIterations = 100000,
71 const double tolerance = 1e-5);
84 const FunctionType&
Function()
const {
return function; }
105 FunctionType&
function;
111 size_t maxIterations;
121 #include "gradient_descent_impl.hpp"
size_t MaxIterations() const
Get the maximum number of iterations (0 indicates no limit).
The core includes that mlpack expects; standard C++ includes and Armadillo.
double & Tolerance()
Modify the tolerance for termination.
Gradient Descent is a technique to minimize a function.
FunctionType & Function()
Modify the instantiated function.
GradientDescent(FunctionType &function, const double stepSize=0.01, const size_t maxIterations=100000, const double tolerance=1e-5)
Construct the Gradient Descent optimizer with the given function and parameters.
double Optimize(arma::mat &iterate)
Optimize the given function using gradient descent.
double StepSize() const
Get the step size.
const FunctionType & Function() const
Get the instantiated function to be optimized.
size_t & MaxIterations()
Modify the maximum number of iterations (0 indicates no limit).
double Tolerance() const
Get the tolerance for termination.
double & StepSize()
Modify the step size.