SHOGUN  4.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
List of all members | Public Member Functions
FirstOrderCostFunction Class Referenceabstract

Detailed Description

The first order cost function base class.

This class gives the interface used in a first-order gradient-based unconstrained minimizer

For example: least square cost function \(f(w)\)

\[ f(w)=\sum_i{(y_i-w^T x_i)^2} \]

where \(w\) is target variable, \(x_i\) is features of the i-th sample, and \(y_i\) is the lable of the i-th sample.

Definition at line 50 of file FirstOrderCostFunction.h.

Inheritance diagram for FirstOrderCostFunction:
Inheritance graph
[legend]

Public Member Functions

virtual float64_t get_cost ()=0
 
virtual SGVector< float64_tobtain_variable_reference ()=0
 
virtual SGVector< float64_tget_gradient ()=0
 

Member Function Documentation

virtual float64_t get_cost ( )
pure virtual

Get the cost given current target variables

For least square, that is the value of \(f(w)\) given \(w\) is known

This method will be called by FirstOrderMinimizer::minimize()

Returns
cost

Implemented in FirstOrderSAGCostFunction, and FirstOrderStochasticCostFunction.

virtual SGVector<float64_t> get_gradient ( )
pure virtual

Get the gradient value wrt target variables

For least squares, that is the value of \(\frac{\partial f(w) }{\partial w}\) given \(w\) is known

This method will be called by FirstOrderMinimizer::minimize()

Returns
gradient of variables

Implemented in FirstOrderSAGCostFunction, and FirstOrderStochasticCostFunction.

virtual SGVector<float64_t> obtain_variable_reference ( )
pure virtual

Obtain a reference of target variables Minimizers will modify target variables in place.

This method will be called by FirstOrderMinimizer::minimize()

For least squares, that is \(w\)

Returns
reference of variables

The documentation for this class was generated from the following file:

SHOGUN Machine Learning Toolbox - Documentation