SHOGUN  4.1.0
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义  
所有成员列表 | Public 成员函数 | Protected 成员函数 | Protected 属性
LBFGSMinimizer类 参考

详细描述

The class wraps the Shogun's C-style LBFGS minimizer.

在文件 LBFGSMinimizer.h49 行定义.

类 LBFGSMinimizer 继承关系图:
Inheritance graph
[图例]

Public 成员函数

 LBFGSMinimizer ()
 
 LBFGSMinimizer (FirstOrderCostFunction *fun)
 
virtual ~LBFGSMinimizer ()
 
virtual float64_t minimize ()
 
virtual bool supports_batch_update () const
 
virtual void set_lbfgs_parameters (int m=100, int max_linesearch=1000, ELBFGSLineSearch linesearch=BACKTRACKING_STRONG_WOLFE, int max_iterations=1000, float64_t delta=0.0, int past=0, float64_t epsilon=1e-5, float64_t min_step=1e-20, float64_t max_step=1e+20, float64_t ftol=1e-4, float64_t wolfe=0.9, float64_t gtol=0.9, float64_t xtol=1e-16, float64_t orthantwise_c=0.0, int orthantwise_start=0, int orthantwise_end=1)
 
virtual CMinimizerContextsave_to_context ()
 
virtual void load_from_context (CMinimizerContext *context)
 
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)
 

Protected 属性

int m_m
 
int m_max_linesearch
 
int m_linesearch
 
int m_max_iterations
 
float64_t m_delta
 
int m_past
 
float64_t m_epsilon
 
float64_t m_min_step
 
float64_t m_max_step
 
float64_t m_ftol
 
float64_t m_wolfe
 
float64_t m_gtol
 
float64_t m_xtol
 
float64_t m_orthantwise_c
 
int m_orthantwise_start
 
int m_orthantwise_end
 
SGVector< float64_tm_target_variable
 
FirstOrderCostFunctionm_fun
 
Penaltym_penalty_type
 
float64_t m_penalty_weight
 

构造及析构函数说明

在文件 LBFGSMinimizer.cpp37 行定义.

Constructor

参数
funcost function (user have to manully delete the pointer)

在文件 LBFGSMinimizer.cpp47 行定义.

~LBFGSMinimizer ( )
virtual

在文件 LBFGSMinimizer.cpp43 行定义.

成员函数说明

virtual float64_t get_penalty ( SGVector< float64_t var)
protectedvirtualinherited

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

参数
varthe variable used in regularization

在文件 FirstOrderMinimizer.h164 行定义.

void init_minimization ( )
protectedvirtual

Init before minimization

在文件 LBFGSMinimizer.cpp94 行定义.

virtual void load_from_context ( CMinimizerContext context)
virtual

Load the given context object to restores mutable variables Usually it is used in deserialization.

参数
contexta context object

重载 FirstOrderMinimizer .

在文件 LBFGSMinimizer.h142 行定义.

float64_t minimize ( )
virtual

Do minimization and get the optimal value

返回
optimal value

实现了 FirstOrderMinimizer.

在文件 LBFGSMinimizer.cpp101 行定义.

virtual CMinimizerContext* save_to_context ( )
virtual

Return a context object which stores mutable variables Usually it is used in serialization.

返回
a context object

重载 FirstOrderMinimizer .

在文件 LBFGSMinimizer.h135 行定义.

virtual void set_cost_function ( FirstOrderCostFunction fun)
virtualinherited

Set cost function used in the minimizer

参数
funthe cost function

在文件 FirstOrderMinimizer.h92 行定义.

void set_lbfgs_parameters ( int  m = 100,
int  max_linesearch = 1000,
ELBFGSLineSearch  linesearch = BACKTRACKING_STRONG_WOLFE,
int  max_iterations = 1000,
float64_t  delta = 0.0,
int  past = 0,
float64_t  epsilon = 1e-5,
float64_t  min_step = 1e-20,
float64_t  max_step = 1e+20,
float64_t  ftol = 1e-4,
float64_t  wolfe = 0.9,
float64_t  gtol = 0.9,
float64_t  xtol = 1e-16,
float64_t  orthantwise_c = 0.0,
int  orthantwise_start = 0,
int  orthantwise_end = 1 
)
virtual

set L-BFGS parameters For details please see shogun/optimization/lbfgs/lbfgs.h

参数
mThe number of corrections to approximate the inverse hessian matrix. Default value is 100.
max_linesearchThe maximum number of trials to do line search for each L-BFGS update. Default value is 1000.
linesearchThe line search algorithm. Default value is using the backtracking with the strong Wolfe condition line search
max_iterationsThe maximum number of iterations for L-BFGS update. Default value is 1000.
deltaDelta for convergence test based on the change of function value. Default value is 0.
pastDistance for delta-based convergence test. Default value is 0.
epsilonEpsilon for convergence test based on the change of gradient. Default value is 1e-5
min_stepThe minimum step of the line search. The default value is 1e-20
max_stepThe maximum step of the line search. The default value is 1e+20
ftolA parameter used in Armijo condition. Default value is 1e-4
wolfeA parameter used in curvature condition. Default value is 0.9
gtolA parameter used in Morethuente linesearch to control the accuracy. Default value is 0.9
xtolThe machine precision for floating-point values. Default value is 1e-16.
orthantwise_cCoeefficient for the L1 norm of variables. This parameter should be set to zero for standard minimization problems. Setting this parameter to a positive value activates Orthant-Wise Limited-memory Quasi-Newton (OWL-QN) method. Default value is 0.
orthantwise_startStart index for computing L1 norm of the variables. This parameter is valid only for OWL-QN method. Default value is 0.
orthantwise_endEnd index for computing L1 norm of the variables. Default value is 1.

在文件 LBFGSMinimizer.cpp58 行定义.

virtual void set_penalty_type ( Penalty penalty_type)
virtualinherited

Set the type of penalty For example, L2 penalty

参数
penalty_typethe type of penalty. If NULL is given, regularization is not enabled.

在文件 FirstOrderMinimizer.h137 行定义.

virtual void set_penalty_weight ( float64_t  penalty_weight)
virtualinherited

Set the weight of penalty

参数
penalty_weightthe weight of penalty, which is positive

在文件 FirstOrderMinimizer.h126 行定义.

virtual bool supports_batch_update ( ) const
virtual

Does minimizer support batch update?

返回
whether minimizer supports batch update

实现了 FirstOrderMinimizer.

在文件 LBFGSMinimizer.h73 行定义.

virtual void update_context ( CMinimizerContext context)
protectedvirtualinherited

Update a context object to store mutable variables

参数
contexta context object

FirstOrderStochasticMinimizer, SMDMinimizer , 以及 SMIDASMinimizer 重载.

在文件 FirstOrderMinimizer.h147 行定义.

virtual void update_gradient ( SGVector< float64_t gradient,
SGVector< float64_t var 
)
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}\)

参数
gradientunpenalized gradient wrt its target variable
varthe target variable

在文件 FirstOrderMinimizer.h190 行定义.

类成员变量说明

float64_t m_delta
protected

Delta for convergence test based on the change of function value.

在文件 LBFGSMinimizer.h174 行定义.

float64_t m_epsilon
protected

Epsilon for convergence test based on the change of gradient.

在文件 LBFGSMinimizer.h180 行定义.

float64_t m_ftol
protected

A parameter used in Armijo condition.

在文件 LBFGSMinimizer.h189 行定义.

FirstOrderCostFunction* m_fun
protectedinherited

Cost function

在文件 FirstOrderMinimizer.h205 行定义.

float64_t m_gtol
protected

A parameter used in Morethuente linesearch to control the accuracy.

在文件 LBFGSMinimizer.h195 行定义.

int m_linesearch
protected

The line search algorithm.

在文件 LBFGSMinimizer.h168 行定义.

int m_m
protected

The number of corrections to approximate the inverse hessian matrix.

在文件 LBFGSMinimizer.h162 行定义.

int m_max_iterations
protected

The maximum number of iterations for L-BFGS update.

在文件 LBFGSMinimizer.h171 行定义.

int m_max_linesearch
protected

The maximum number of trials to do line search for each L-BFGS update.

在文件 LBFGSMinimizer.h165 行定义.

float64_t m_max_step
protected

The maximum step of the line search.

在文件 LBFGSMinimizer.h186 行定义.

float64_t m_min_step
protected

The minimum step of the line search.

在文件 LBFGSMinimizer.h183 行定义.

float64_t m_orthantwise_c
protected

Coeefficient for the L1 norm of variables.

在文件 LBFGSMinimizer.h201 行定义.

int m_orthantwise_end
protected

End index for computing L1 norm of the variables.

在文件 LBFGSMinimizer.h207 行定义.

int m_orthantwise_start
protected

Start index for computing L1 norm of the variables.

在文件 LBFGSMinimizer.h204 行定义.

int m_past
protected

Distance for delta-based convergence test.

在文件 LBFGSMinimizer.h177 行定义.

Penalty* m_penalty_type
protectedinherited

the type of penalty

在文件 FirstOrderMinimizer.h208 行定义.

float64_t m_penalty_weight
protectedinherited

the weight of penalty

在文件 FirstOrderMinimizer.h211 行定义.

SGVector<float64_t> m_target_variable
protected

Target variable

在文件 LBFGSMinimizer.h210 行定义.

float64_t m_wolfe
protected

A parameter used in curvature condition.

在文件 LBFGSMinimizer.h192 行定义.

float64_t m_xtol
protected

The machine precision for floating-point values.

在文件 LBFGSMinimizer.h198 行定义.


该类的文档由以下文件生成:

SHOGUN 机器学习工具包 - 项目文档