The class wraps the external NLOPT library.
This minimizer supports bound constrainted minimization and unconstrainted minimization using the NLOPT library
在文件 NLOPTMinimizer.h 第 47 行定义.
Public 成员函数 | |
NLOPTMinimizer () | |
NLOPTMinimizer (FirstOrderCostFunction *fun) | |
virtual | ~NLOPTMinimizer () |
virtual float64_t | minimize () |
virtual bool | supports_batch_update () const |
virtual CMinimizerContext * | save_to_context () |
virtual void | load_from_context (CMinimizerContext *context) |
virtual void | set_nlopt_parameters (nlopt_algorithm algorithm=NLOPT_LD_LBFGS, float64_t max_iterations=1000, float64_t variable_tolerance=1e-6, float64_t function_tolerance=1e-6) |
virtual void | set_cost_function (FirstOrderCostFunction *fun) |
virtual void | set_penalty_weight (float64_t penalty_weight) |
virtual void | set_penalty_type (Penalty *penalty_type) |
Protected 成员函数 | |
virtual void | init_minimization () |
virtual void | update_context (CMinimizerContext *context) |
virtual float64_t | get_penalty (SGVector< float64_t > var) |
virtual void | update_gradient (SGVector< float64_t > gradient, SGVector< float64_t > var) |
NLOPTMinimizer | ( | ) |
Default constructor
在文件 NLOPTMinimizer.cpp 第 37 行定义.
NLOPTMinimizer | ( | FirstOrderCostFunction * | fun | ) |
|
virtual |
Destructor
在文件 NLOPTMinimizer.cpp 第 43 行定义.
Get the penalty given target variables For L2 penalty, the target variable is \(w\) and the value of penalty is \(\lambda \frac{w^t w}{2}\), where \(\lambda\) is the weight of penalty
var | the variable used in regularization |
在文件 FirstOrderMinimizer.h 第 164 行定义.
|
protectedvirtual |
在文件 NLOPTMinimizer.cpp 第 163 行定义.
|
virtual |
Load the given context object to restores mutable variables Usually it is used in deserialization.
context | a context object |
重载 FirstOrderMinimizer .
在文件 NLOPTMinimizer.h 第 85 行定义.
|
virtual |
Do minimization and get the optimal value
实现了 FirstOrderMinimizer.
在文件 NLOPTMinimizer.cpp 第 65 行定义.
|
virtual |
Return a context object which stores mutable variables Usually it is used in serialization.
重载 FirstOrderMinimizer .
在文件 NLOPTMinimizer.h 第 78 行定义.
|
virtualinherited |
|
virtual |
在文件 NLOPTMinimizer.cpp 第 133 行定义.
|
virtualinherited |
Set the type of penalty For example, L2 penalty
penalty_type | the type of penalty. If NULL is given, regularization is not enabled. |
在文件 FirstOrderMinimizer.h 第 137 行定义.
|
virtualinherited |
Set the weight of penalty
penalty_weight | the weight of penalty, which is positive |
在文件 FirstOrderMinimizer.h 第 126 行定义.
|
virtual |
Does minimizer support batch update?
实现了 FirstOrderMinimizer.
在文件 NLOPTMinimizer.h 第 71 行定义.
|
protectedvirtualinherited |
Update a context object to store mutable variables
context | a context object |
被 FirstOrderStochasticMinimizer, SMDMinimizer , 以及 SMIDASMinimizer 重载.
在文件 FirstOrderMinimizer.h 第 147 行定义.
|
protectedvirtualinherited |
Add gradient of the penalty wrt target variables to unpenalized gradient For least sqaure with L2 penalty,
\[ L2f(w)=f(w) + L2(w) \]
where \( f(w)=\sum_i{(y_i-w^T x_i)^2}\) is the least sqaure cost function and \(L2(w)=\lambda \frac{w^t w}{2}\) is the L2 penalty
Target variables is \(w\) Unpenalized gradient is \(\frac{\partial f(w) }{\partial w}\) Gradient of the penalty wrt target variables is \(\frac{\partial L2(w) }{\partial w}\)
gradient | unpenalized gradient wrt its target variable |
var | the target variable |
在文件 FirstOrderMinimizer.h 第 190 行定义.
|
protectedinherited |
Cost function
在文件 FirstOrderMinimizer.h 第 205 行定义.
|
protected |
absolute tolerance on function value
在文件 NLOPTMinimizer.h 第 123 行定义.
|
protected |
max number of iterations
在文件 NLOPTMinimizer.h 第 117 行定义.
|
protected |
algorithm provided by NLOPT for minimization
在文件 NLOPTMinimizer.h 第 126 行定义.
|
protectedinherited |
the type of penalty
在文件 FirstOrderMinimizer.h 第 208 行定义.
|
protectedinherited |
the weight of penalty
在文件 FirstOrderMinimizer.h 第 211 行定义.
在文件 NLOPTMinimizer.h 第 111 行定义.
|
protected |
absolute tolerance on optimization parameters
在文件 NLOPTMinimizer.h 第 120 行定义.