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

详细描述

The class implements the stochastic mirror descend (SMD) minimizer.

在文件 SMDMinimizer.h44 行定义.

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

Public 成员函数

 SMDMinimizer ()
 
 SMDMinimizer (FirstOrderStochasticCostFunction *fun)
 
virtual ~SMDMinimizer ()
 
virtual float64_t minimize ()
 
virtual void set_mapping_function (MappingFunction *mapping_fun)
 
virtual void load_from_context (CMinimizerContext *context)
 
virtual bool supports_batch_update () const
 
virtual void set_gradient_updater (DescendUpdater *gradient_updater)
 
virtual void set_number_passes (int32_t num_passes)
 
virtual void set_learning_rate (LearningRate *learning_rate)
 
virtual int32_t get_iteration_counter ()
 
virtual void set_cost_function (FirstOrderCostFunction *fun)
 
virtual CMinimizerContextsave_to_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 void init_minimization ()
 
virtual void do_proximal_operation (SGVector< float64_t >variable_reference)
 
virtual float64_t get_penalty (SGVector< float64_t > var)
 
virtual void update_gradient (SGVector< float64_t > gradient, SGVector< float64_t > var)
 

Protected 属性

MappingFunctionm_mapping_fun
 
DescendUpdaterm_gradient_updater
 
int32_t m_num_passes
 
int32_t m_cur_passes
 
int32_t m_iter_counter
 
LearningRatem_learning_rate
 
FirstOrderCostFunctionm_fun
 
Penaltym_penalty_type
 
float64_t m_penalty_weight
 

构造及析构函数说明

Default constructor

在文件 SMDMinimizer.cpp36 行定义.

Constructor

参数
funstochastic cost function

在文件 SMDMinimizer.cpp46 行定义.

~SMDMinimizer ( )
virtual

Destructor

在文件 SMDMinimizer.cpp42 行定义.

成员函数说明

virtual void do_proximal_operation ( SGVector< float64_t variable_reference)
protectedvirtualinherited

Do proximal update in place

参数
variable_referencevariable_reference to be updated

在文件 FirstOrderStochasticMinimizer.h167 行定义.

virtual int32_t get_iteration_counter ( )
virtualinherited

How many samples/mini-batch does the minimizer use?

返回
the number of samples/mini-batches used in optimization

在文件 FirstOrderStochasticMinimizer.h160 行定义.

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 the minimization process

重载 FirstOrderStochasticMinimizer .

SMIDASMinimizer 重载.

在文件 SMDMinimizer.cpp85 行定义.

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

重载 FirstOrderStochasticMinimizer .

SMIDASMinimizer 重载.

在文件 SMDMinimizer.h78 行定义.

float64_t minimize ( )
virtual

Do minimization and get the optimal value

返回
optimal value

实现了 FirstOrderStochasticMinimizer.

SMIDASMinimizer 重载.

在文件 SMDMinimizer.cpp52 行定义.

virtual CMinimizerContext* save_to_context ( )
virtualinherited

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

返回
a context object

LBFGSMinimizer , 以及 NLOPTMinimizer 重载.

在文件 FirstOrderMinimizer.h103 行定义.

virtual void set_cost_function ( FirstOrderCostFunction fun)
virtualinherited

Set cost function used in the minimizer

参数
funthe cost function

在文件 FirstOrderMinimizer.h92 行定义.

virtual void set_gradient_updater ( DescendUpdater gradient_updater)
virtualinherited

Set a gradient updater

参数
gradient_updaterthe gradient_updater

在文件 FirstOrderStochasticMinimizer.h104 行定义.

virtual void set_learning_rate ( LearningRate learning_rate)
virtualinherited

Set the learning rate of a minimizer

参数
learning_ratelearn rate or step size

在文件 FirstOrderStochasticMinimizer.h151 行定义.

virtual void set_mapping_function ( MappingFunction mapping_fun)
virtual

Set projection function

参数
mapping_funmapping/projection function

在文件 SMDMinimizer.h67 行定义.

virtual void set_number_passes ( int32_t  num_passes)
virtualinherited

Set the number of times to go through all data points (samples) For example, num_passes=1 means go through all data points once.

Recall that a stochastic cost function \(f(w)\) can be written as \(\sum_i{ f_i(w) }\), where \(f_i(w)\) is the differentiable function for the i-th sample.

参数
num_passesthe number of times

在文件 FirstOrderStochasticMinimizer.h125 行定义.

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
virtualinherited

Does minimizer support batch update

返回
whether minimizer supports batch update

实现了 FirstOrderMinimizer.

在文件 FirstOrderStochasticMinimizer.h98 行定义.

virtual void update_context ( CMinimizerContext context)
protectedvirtual

Update a context object to store mutable variables

参数
contexta context object

重载 FirstOrderStochasticMinimizer .

SMIDASMinimizer 重载.

在文件 SMDMinimizer.h90 行定义.

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

类成员变量说明

int32_t m_cur_passes
protectedinherited

current iteration to go through data

在文件 FirstOrderStochasticMinimizer.h215 行定义.

FirstOrderCostFunction* m_fun
protectedinherited

Cost function

在文件 FirstOrderMinimizer.h205 行定义.

DescendUpdater* m_gradient_updater
protectedinherited

the gradient update step

在文件 FirstOrderStochasticMinimizer.h200 行定义.

int32_t m_iter_counter
protectedinherited

number of used samples/mini-batches

在文件 FirstOrderStochasticMinimizer.h218 行定义.

LearningRate* m_learning_rate
protectedinherited

learning_rate object

在文件 FirstOrderStochasticMinimizer.h221 行定义.

MappingFunction* m_mapping_fun
protected

mapping function

在文件 SMDMinimizer.h100 行定义.

int32_t m_num_passes
protectedinherited

iteration to go through data

在文件 FirstOrderStochasticMinimizer.h212 行定义.

Penalty* m_penalty_type
protectedinherited

the type of penalty

在文件 FirstOrderMinimizer.h208 行定义.

float64_t m_penalty_weight
protectedinherited

the weight of penalty

在文件 FirstOrderMinimizer.h211 行定义.


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

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