SG++-Doxygen-Documentation
|
Gradient-based nonlinear conjugate gradient method. More...
#include <NLCG.hpp>
Public Member Functions | |
void | clone (std::unique_ptr< UnconstrainedOptimizer > &clone) const override |
double | getBeta () const |
double | getEpsilon () const |
double | getGamma () const |
ScalarFunctionGradient & | getObjectiveGradient () const |
double | getRestartThreshold () const |
double | getTolerance () const |
NLCG (const ScalarFunction &f, const ScalarFunctionGradient &fGradient, size_t maxItCount=DEFAULT_N, double beta=DEFAULT_BETA, double gamma=DEFAULT_GAMMA, double tolerance=DEFAULT_TOLERANCE, double epsilon=DEFAULT_EPSILON, double restartThreshold=DEFAULT_RESTART_THRESHOLD) | |
Constructor. More... | |
NLCG (const NLCG &other) | |
Copy constructor. More... | |
void | optimize () override |
Pure virtual method for optimization of the objective function. More... | |
void | setBeta (double beta) |
void | setEpsilon (double epsilon) |
void | setGamma (double gamma) |
void | setRestartThreshold (double restartThreshold) |
void | setTolerance (double tolerance) |
~NLCG () override | |
Destructor. More... | |
Public Member Functions inherited from sgpp::optimization::optimizer::UnconstrainedOptimizer | |
const base::DataMatrix & | getHistoryOfOptimalPoints () const |
const base::DataVector & | getHistoryOfOptimalValues () const |
size_t | getN () const |
ScalarFunction & | getObjectiveFunction () const |
const base::DataVector & | getOptimalPoint () const |
double | getOptimalValue () const |
const base::DataVector & | getStartingPoint () const |
void | setN (size_t N) |
void | setStartingPoint (const base::DataVector &startingPoint) |
UnconstrainedOptimizer (const ScalarFunction &f, size_t N=DEFAULT_N) | |
Constructor. More... | |
UnconstrainedOptimizer (const UnconstrainedOptimizer &other) | |
Copy constructor. More... | |
virtual | ~UnconstrainedOptimizer () |
Destructor. More... | |
Static Public Attributes | |
static constexpr double | DEFAULT_BETA = 0.5 |
default beta (parameter for Armijo's rule) More... | |
static constexpr double | DEFAULT_EPSILON = 1e-18 |
default epsilon (parameter for Armijo's rule) More... | |
static constexpr double | DEFAULT_GAMMA = 1e-2 |
default gamma (parameter for Armijo's rule) More... | |
static constexpr double | DEFAULT_RESTART_THRESHOLD = 0.1 |
default restart threshold More... | |
static constexpr double | DEFAULT_TOLERANCE = 1e-8 |
default tolerance (parameter for Armijo's rule) More... | |
Static Public Attributes inherited from sgpp::optimization::optimizer::UnconstrainedOptimizer | |
static const size_t | DEFAULT_N = 1000 |
default maximal number of iterations or function evaluations More... | |
Protected Attributes | |
double | alpha |
restart threshold More... | |
double | beta |
beta (parameter for Armijo's rule) More... | |
double | eps |
epsilon (parameter for Armijo's rule) More... | |
std::unique_ptr< ScalarFunctionGradient > | fGradient |
objective function gradient More... | |
double | gamma |
gamma (parameter for Armijo's rule) More... | |
double | tol |
tolerance (parameter for Armijo's rule) More... | |
Protected Attributes inherited from sgpp::optimization::optimizer::UnconstrainedOptimizer | |
std::unique_ptr< ScalarFunction > | f |
objective function More... | |
base::DataVector | fHist |
search history vector (optimal values) More... | |
double | fOpt |
result of optimization (optimal function value) More... | |
size_t | N |
maximal number of iterations or function evaluations More... | |
base::DataVector | x0 |
starting point More... | |
base::DataMatrix | xHist |
search history matrix (optimal points) More... | |
base::DataVector | xOpt |
result of optimization (location of optimum) More... | |
Gradient-based nonlinear conjugate gradient method.
The method is restarted with the steepest descent direction if the normalized absolute value of the inner product of two successive gradients exceeds a "restart threshold" \(\alpha\).
sgpp::optimization::optimizer::NLCG::NLCG | ( | const ScalarFunction & | f, |
const ScalarFunctionGradient & | fGradient, | ||
size_t | maxItCount = DEFAULT_N , |
||
double | beta = DEFAULT_BETA , |
||
double | gamma = DEFAULT_GAMMA , |
||
double | tolerance = DEFAULT_TOLERANCE , |
||
double | epsilon = DEFAULT_EPSILON , |
||
double | restartThreshold = DEFAULT_RESTART_THRESHOLD |
||
) |
Constructor.
f | objective function |
fGradient | objective function gradient |
maxItCount | maximal number of iterations |
beta | beta (parameter for Armijo's rule) |
gamma | gamma (parameter for Armijo's rule) |
tolerance | tolerance (parameter for Armijo's rule) |
epsilon | epsilon (parameter for Armijo's rule) |
restartThreshold | restart threshold |
References sgpp::optimization::ScalarFunctionGradient::clone().
Referenced by clone().
sgpp::optimization::optimizer::NLCG::NLCG | ( | const NLCG & | other | ) |
|
override |
Destructor.
|
overridevirtual |
[out] | clone | pointer to cloned object |
Implements sgpp::optimization::optimizer::UnconstrainedOptimizer.
References NLCG().
double sgpp::optimization::optimizer::NLCG::getBeta | ( | ) | const |
References beta.
double sgpp::optimization::optimizer::NLCG::getEpsilon | ( | ) | const |
References eps.
double sgpp::optimization::optimizer::NLCG::getGamma | ( | ) | const |
References gamma.
ScalarFunctionGradient & sgpp::optimization::optimizer::NLCG::getObjectiveGradient | ( | ) | const |
References fGradient.
double sgpp::optimization::optimizer::NLCG::getRestartThreshold | ( | ) | const |
References alpha.
double sgpp::optimization::optimizer::NLCG::getTolerance | ( | ) | const |
References tol.
|
overridevirtual |
Pure virtual method for optimization of the objective function.
The result of the optimization process can be obtained by member functions, e.g., getOptimalPoint() and getOptimalValue().
Implements sgpp::optimization::optimizer::UnconstrainedOptimizer.
References alpha, sgpp::base::DataVector::append(), sgpp::base::DataMatrix::appendRow(), beta, sgpp::base::DataVector::dotProduct(), eps, sgpp::optimization::optimizer::UnconstrainedOptimizer::f, fGradient, sgpp::optimization::optimizer::UnconstrainedOptimizer::fHist, sgpp::optimization::optimizer::UnconstrainedOptimizer::fOpt, gamma, sgpp::optimization::Printer::getInstance(), sgpp::base::DataVector::l2Norm(), sgpp::optimization::optimizer::lineSearchArmijo(), sgpp::optimization::optimizer::UnconstrainedOptimizer::N, sgpp::optimization::Printer::printStatusBegin(), sgpp::optimization::Printer::printStatusEnd(), sgpp::optimization::Printer::printStatusUpdate(), sgpp::base::DataMatrix::resize(), create_scripts::s, tol, sgpp::base::DataVector::toString(), sgpp::optimization::optimizer::UnconstrainedOptimizer::x0, sgpp::optimization::optimizer::UnconstrainedOptimizer::xHist, and sgpp::optimization::optimizer::UnconstrainedOptimizer::xOpt.
void sgpp::optimization::optimizer::NLCG::setBeta | ( | double | beta | ) |
beta | beta (parameter for Armijo's rule) |
References beta.
void sgpp::optimization::optimizer::NLCG::setEpsilon | ( | double | epsilon | ) |
epsilon | epsilon (parameter for Armijo's rule) |
References eps.
void sgpp::optimization::optimizer::NLCG::setGamma | ( | double | gamma | ) |
gamma | gamma (parameter for Armijo's rule) |
References gamma.
void sgpp::optimization::optimizer::NLCG::setRestartThreshold | ( | double | restartThreshold | ) |
restartThreshold | restart threshold |
References alpha.
void sgpp::optimization::optimizer::NLCG::setTolerance | ( | double | tolerance | ) |
tolerance | tolerance (parameter for Armijo's rule) |
References tol.
|
protected |
restart threshold
Referenced by getRestartThreshold(), optimize(), python.learner.Classifier.Classifier::refineGrid(), and setRestartThreshold().
|
protected |
beta (parameter for Armijo's rule)
Referenced by getBeta(), optimize(), and setBeta().
|
static |
default beta (parameter for Armijo's rule)
|
static |
default epsilon (parameter for Armijo's rule)
|
static |
default gamma (parameter for Armijo's rule)
|
static |
default restart threshold
|
static |
default tolerance (parameter for Armijo's rule)
|
protected |
epsilon (parameter for Armijo's rule)
Referenced by getEpsilon(), optimize(), and setEpsilon().
|
protected |
objective function gradient
Referenced by getObjectiveGradient(), NLCG(), and optimize().
|
protected |
gamma (parameter for Armijo's rule)
Referenced by getGamma(), optimize(), and setGamma().
|
protected |
tolerance (parameter for Armijo's rule)
Referenced by getTolerance(), optimize(), and setTolerance().