Vowpal Wabbit
Public Member Functions | List of all members
classic_squaredloss Class Reference
Inheritance diagram for classic_squaredloss:
loss_function

Public Member Functions

std::string getType ()
 
float getLoss (shared_data *, float prediction, float label)
 
float getUpdate (float prediction, float label, float update_scale, float)
 
float getUnsafeUpdate (float prediction, float label, float update_scale)
 
float getRevertingWeight (shared_data *sd, float prediction, float eta_t)
 
float getSquareGrad (float prediction, float label)
 
float first_derivative (shared_data *, float prediction, float label)
 
float second_derivative (shared_data *, float, float)
 
- Public Member Functions inherited from loss_function
virtual ~loss_function ()
 

Detailed Description

Definition at line 83 of file loss_functions.cc.

Member Function Documentation

◆ first_derivative()

float classic_squaredloss::first_derivative ( shared_data ,
float  prediction,
float  label 
)
inlinevirtual

Implements loss_function.

Definition at line 112 of file loss_functions.cc.

112 { return 2.f * (prediction - label); }

◆ getLoss()

float classic_squaredloss::getLoss ( shared_data ,
float  prediction,
float  label 
)
inlinevirtual

Implements loss_function.

Definition at line 88 of file loss_functions.cc.

89  {
90  float example_loss = (prediction - label) * (prediction - label);
91  return example_loss;
92  }

◆ getRevertingWeight()

float classic_squaredloss::getRevertingWeight ( shared_data sd,
float  prediction,
float  eta_t 
)
inlinevirtual

Implements loss_function.

Definition at line 104 of file loss_functions.cc.

References shared_data::max_label, and shared_data::min_label.

105  {
106  float t = 0.5f * (sd->min_label + sd->max_label);
107  float alternative = (prediction > t) ? sd->min_label : sd->max_label;
108  return (t - prediction) / ((alternative - prediction) * eta_t);
109  }
float min_label
Definition: global_data.h:150
float max_label
Definition: global_data.h:151

◆ getSquareGrad()

float classic_squaredloss::getSquareGrad ( float  prediction,
float  label 
)
inlinevirtual

Implements loss_function.

Definition at line 111 of file loss_functions.cc.

111 { return 4.f * (prediction - label) * (prediction - label); }

◆ getType()

std::string classic_squaredloss::getType ( )
inlinevirtual

Implements loss_function.

Definition at line 86 of file loss_functions.cc.

86 { return "classic"; }

◆ getUnsafeUpdate()

float classic_squaredloss::getUnsafeUpdate ( float  prediction,
float  label,
float  update_scale 
)
inlinevirtual

Implements loss_function.

Definition at line 99 of file loss_functions.cc.

100  {
101  return 2.f * (label - prediction) * update_scale;
102  }

◆ getUpdate()

float classic_squaredloss::getUpdate ( float  prediction,
float  label,
float  update_scale,
float   
)
inlinevirtual

Implements loss_function.

Definition at line 94 of file loss_functions.cc.

95  {
96  return 2.f * (label - prediction) * update_scale;
97  }

◆ second_derivative()

float classic_squaredloss::second_derivative ( shared_data ,
float  ,
float   
)
inlinevirtual

Implements loss_function.

Definition at line 113 of file loss_functions.cc.

113 { return 2.; }

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