Public Member Functions

CLossFunction Class Reference


Detailed Description

Class CLossFunction is the base class of all loss functions.

The class provides the loss for one example, first and second derivates of the loss function, (used very commonly) the square of the gradient and the importance-aware weight update for the function. (used mainly for VW)

Refer: Online Importance Weight Aware Updates, Nikos Karampatziakis, John Langford http://arxiv.org/abs/1011.1576

Definition at line 52 of file LossFunction.h.

Inheritance diagram for CLossFunction:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 CLossFunction ()
virtual ~CLossFunction ()
virtual float64_t loss (float64_t prediction, float64_t label)=0
virtual float64_t first_derivative (float64_t prediction, float64_t label)=0
virtual float64_t second_derivative (float64_t prediction, float64_t label)=0
virtual float64_t get_update (float64_t prediction, float64_t label, float64_t eta_t, float64_t norm)=0
virtual float64_t get_square_grad (float64_t prediction, float64_t label)=0
virtual ELossType get_loss_type ()=0
virtual const char * get_name () const

Constructor & Destructor Documentation

CLossFunction (  ) 

Constructor

Definition at line 59 of file LossFunction.h.

virtual ~CLossFunction (  )  [virtual]

Destructor

Definition at line 64 of file LossFunction.h.


Member Function Documentation

virtual float64_t first_derivative ( float64_t  prediction,
float64_t  label 
) [pure virtual]

Get first derivative of the loss function

Parameters:
prediction prediction
label label
Returns:
first derivative

Implemented in CHingeLoss, CLogLoss, CLogLossMargin, CSmoothHingeLoss, CSquaredHingeLoss, and CSquaredLoss.

virtual ELossType get_loss_type (  )  [pure virtual]

Get loss type

abstract base method

Returns:
loss type as enum

Implemented in CHingeLoss, CLogLoss, CLogLossMargin, CSmoothHingeLoss, CSquaredHingeLoss, and CSquaredLoss.

virtual const char* get_name (  )  const [virtual]

Return the name of the object

Returns:
LossFunction

Implements CSGObject.

Reimplemented in CHingeLoss, CLogLoss, CLogLossMargin, CSmoothHingeLoss, CSquaredHingeLoss, and CSquaredLoss.

Definition at line 132 of file LossFunction.h.

virtual float64_t get_square_grad ( float64_t  prediction,
float64_t  label 
) [pure virtual]

Get square of gradient, used for adaptive learning

Parameters:
prediction prediction
label label
Returns:
square of gradient

Implemented in CHingeLoss, CLogLoss, CLogLossMargin, CSmoothHingeLoss, CSquaredHingeLoss, and CSquaredLoss.

virtual float64_t get_update ( float64_t  prediction,
float64_t  label,
float64_t  eta_t,
float64_t  norm 
) [pure virtual]

Get importance aware weight update for this loss function

Parameters:
prediction prediction
label label
eta_t learning rate at update number t
norm scale value
Returns:
update

Implemented in CHingeLoss, CLogLoss, CLogLossMargin, CSmoothHingeLoss, CSquaredHingeLoss, and CSquaredLoss.

virtual float64_t loss ( float64_t  prediction,
float64_t  label 
) [pure virtual]

Get loss for an example

Parameters:
prediction prediction
label label
Returns:
loss

Implemented in CHingeLoss, CLogLoss, CLogLossMargin, CSmoothHingeLoss, CSquaredHingeLoss, and CSquaredLoss.

virtual float64_t second_derivative ( float64_t  prediction,
float64_t  label 
) [pure virtual]

Get second derivative of the loss function

Parameters:
prediction prediction
label label
Returns:
second derivative

Implemented in CHingeLoss, CLogLoss, CLogLossMargin, CSmoothHingeLoss, CSquaredHingeLoss, and CSquaredLoss.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation