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

详细描述

The class wraps the external NLOPT library.

This minimizer supports bound constrainted minimization and unconstrainted minimization using the NLOPT library

在文件 NLOPTMinimizer.h47 行定义.

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

Public 成员函数

 NLOPTMinimizer ()
 
 NLOPTMinimizer (FirstOrderCostFunction *fun)
 
virtual ~NLOPTMinimizer ()
 
virtual float64_t minimize ()
 
virtual bool supports_batch_update () const
 
virtual CMinimizerContextsave_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)
 

Protected 属性

SGVector< float64_tm_target_variable
 
float64_t m_max_iterations
 
float64_t m_variable_tolerance
 
float64_t m_function_tolerance
 
nlopt_algorithm m_nlopt_algorithm
 
FirstOrderCostFunctionm_fun
 
Penaltym_penalty_type
 
float64_t m_penalty_weight
 

构造及析构函数说明

Default constructor

在文件 NLOPTMinimizer.cpp37 行定义.

Constructor

参数
funcost function

在文件 NLOPTMinimizer.cpp47 行定义.

~NLOPTMinimizer ( )
virtual

Destructor

在文件 NLOPTMinimizer.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

在文件 NLOPTMinimizer.cpp163 行定义.

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 .

在文件 NLOPTMinimizer.h85 行定义.

float64_t minimize ( )
virtual

Do minimization and get the optimal value

返回
optimal value

实现了 FirstOrderMinimizer.

在文件 NLOPTMinimizer.cpp65 行定义.

virtual CMinimizerContext* save_to_context ( )
virtual

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

返回
a context object

重载 FirstOrderMinimizer .

在文件 NLOPTMinimizer.h78 行定义.

virtual void set_cost_function ( FirstOrderCostFunction fun)
virtualinherited

Set cost function used in the minimizer

参数
funthe cost function

在文件 FirstOrderMinimizer.h92 行定义.

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

在文件 NLOPTMinimizer.cpp133 行定义.

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.

在文件 NLOPTMinimizer.h71 行定义.

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 行定义.

类成员变量说明

FirstOrderCostFunction* m_fun
protectedinherited

Cost function

在文件 FirstOrderMinimizer.h205 行定义.

float64_t m_function_tolerance
protected

absolute tolerance on function value

在文件 NLOPTMinimizer.h123 行定义.

float64_t m_max_iterations
protected

max number of iterations

在文件 NLOPTMinimizer.h117 行定义.

nlopt_algorithm m_nlopt_algorithm
protected

algorithm provided by NLOPT for minimization

在文件 NLOPTMinimizer.h126 行定义.

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

在文件 NLOPTMinimizer.h111 行定义.

float64_t m_variable_tolerance
protected

absolute tolerance on optimization parameters

在文件 NLOPTMinimizer.h120 行定义.


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

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