The first order minimizer base class.
This class gives the interface of a first-order gradient-based unconstrained minimizer
This kind of minimizers will find optimal target variables based on gradient information wrt target variables. For example, the gradient descend method is a minimizer.
A minimizer requires the following objects as input: a supported cost function object (eg, FirstOrderCostFunction ) a penalty object if regularization is enabled (eg, Penalty ) a context object to restore mutable variables if deserialization is actived (eg, CMinimizerContext )
在文件 FirstOrderMinimizer.h 第 54 行定义.
Public 成员函数 | |
FirstOrderMinimizer () | |
FirstOrderMinimizer (FirstOrderCostFunction *fun) | |
virtual | ~FirstOrderMinimizer () |
virtual float64_t | minimize ()=0 |
virtual bool | supports_batch_update () const =0 |
virtual void | set_cost_function (FirstOrderCostFunction *fun) |
virtual CMinimizerContext * | save_to_context () |
virtual void | load_from_context (CMinimizerContext *context) |
virtual void | set_penalty_weight (float64_t penalty_weight) |
virtual void | set_penalty_type (Penalty *penalty_type) |
Protected 成员函数 | |
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) |
Protected 属性 | |
FirstOrderCostFunction * | m_fun |
Penalty * | m_penalty_type |
float64_t | m_penalty_weight |
Default constructor
在文件 FirstOrderMinimizer.h 第 58 行定义.
Constructor
fun | cost function (user have to manully delete the pointer) |
在文件 FirstOrderMinimizer.h 第 66 行定义.
|
virtual |
Destructor
在文件 FirstOrderMinimizer.h 第 73 行定义.
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 行定义.
|
virtual |
Load the given context object to restores mutable variables Usually it is used in deserialization.
context | a context object |
被 LBFGSMinimizer, FirstOrderStochasticMinimizer, NLOPTMinimizer, SMDMinimizer , 以及 SMIDASMinimizer 重载.
在文件 FirstOrderMinimizer.h 第 115 行定义.
|
pure virtual |
Do minimization and get the optimal value
在 FirstOrderStochasticMinimizer, LBFGSMinimizer, SMIDASMinimizer, NLOPTMinimizer, SVRGMinimizer, SGDMinimizer , 以及 SMDMinimizer 内被实现.
|
virtual |
Return a context object which stores mutable variables Usually it is used in serialization.
被 LBFGSMinimizer , 以及 NLOPTMinimizer 重载.
在文件 FirstOrderMinimizer.h 第 103 行定义.
|
virtual |
|
virtual |
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 行定义.
|
virtual |
Set the weight of penalty
penalty_weight | the weight of penalty, which is positive |
在文件 FirstOrderMinimizer.h 第 126 行定义.
|
pure virtual |
Does minimizer support batch update?
在 FirstOrderStochasticMinimizer, LBFGSMinimizer , 以及 NLOPTMinimizer 内被实现.
|
protectedvirtual |
Update a context object to store mutable variables
context | a context object |
被 FirstOrderStochasticMinimizer, SMDMinimizer , 以及 SMIDASMinimizer 重载.
在文件 FirstOrderMinimizer.h 第 147 行定义.
|
protectedvirtual |
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 行定义.
|
protected |
Cost function
在文件 FirstOrderMinimizer.h 第 205 行定义.
|
protected |
the type of penalty
在文件 FirstOrderMinimizer.h 第 208 行定义.
|
protected |
the weight of penalty
在文件 FirstOrderMinimizer.h 第 211 行定义.