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>
84 const FunctionType&
Function()
const {
return function; }
105 FunctionType&
function;
121 #include "gradient_descent_impl.hpp" double stepSize
The step size for each example.
Linear algebra utility functions, generally performed on matrices or vectors.
double Tolerance() const
Get the tolerance for termination.
The core includes that mlpack expects; standard C++ includes and Armadillo.
double Optimize(arma::mat &iterate)
Optimize the given function using gradient descent.
Gradient Descent is a technique to minimize a function.
size_t MaxIterations() const
Get the maximum number of iterations (0 indicates no limit).
double tolerance
The tolerance for termination.
size_t maxIterations
The maximum number of allowed iterations.
double StepSize() const
Get the step size.
double & Tolerance()
Modify the tolerance for termination.
const FunctionType & Function() const
Get the instantiated function to be optimized.
double & StepSize()
Modify the step size.
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.
FunctionType & Function()
Modify the instantiated function.
size_t & MaxIterations()
Modify the maximum number of iterations (0 indicates no limit).