MarginRankingLoss< InputDataType, OutputDataType > Class Template Reference

Margin ranking loss measures the loss given inputs and a label vector with values of 1 or -1. More...

Public Member Functions

 MarginRankingLoss (const double margin=1.0)
 Create the MarginRankingLoss object with Hyperparameter margin. More...

 
template
void Backward (const InputType &input, const TargetType &target, OutputType &output)
 Ordinary feed backward pass of a neural network. More...

 
template
InputType::elem_type Forward (const InputType &input, const TargetType &target)
 Computes the Margin Ranking Loss function. More...

 
double Margin () const
 Get the margin parameter. More...

 
double & Margin ()
 Modify the margin parameter. More...

 
OutputDataType & OutputParameter () const
 Get the output parameter. More...

 
OutputDataType & OutputParameter ()
 Modify the output parameter. More...

 
template
void serialize (Archive &ar, const unsigned int)
 Serialize the layer. More...

 

Detailed Description


template
class mlpack::ann::MarginRankingLoss< InputDataType, OutputDataType >

Margin ranking loss measures the loss given inputs and a label vector with values of 1 or -1.

If the label is 1 then the first input should be ranked higher than the second input at a distance larger than a margin, and vice- versa if the label is -1.

Template Parameters
InputDataTypeType of the input data (arma::colvec, arma::mat, arma::sp_mat or arma::cube).
OutputDataTypeType of the output data (arma::colvec, arma::mat, arma::sp_mat or arma::cube).

Definition at line 35 of file margin_ranking_loss.hpp.

Constructor & Destructor Documentation

◆ MarginRankingLoss()

MarginRankingLoss ( const double  margin = 1.0)

Create the MarginRankingLoss object with Hyperparameter margin.

Hyperparameter margin defines a minimum distance between correctly ranked samples.

Member Function Documentation

◆ Backward()

void Backward ( const InputType &  input,
const TargetType &  target,
OutputType &  output 
)

Ordinary feed backward pass of a neural network.

Parameters
inputThe propagated concatenated input activation.
targetThe label vector which contains -1 or 1 values.
outputThe calculated error.

◆ Forward()

InputType::elem_type Forward ( const InputType &  input,
const TargetType &  target 
)

Computes the Margin Ranking Loss function.

Parameters
inputConcatenation of the two inputs for evaluating the specified function.
targetThe label vector which contains values of -1 or 1.

◆ Margin() [1/2]

double Margin ( ) const
inline

Get the margin parameter.

Definition at line 78 of file margin_ranking_loss.hpp.

◆ Margin() [2/2]

double& Margin ( )
inline

Modify the margin parameter.

Definition at line 80 of file margin_ranking_loss.hpp.

References MarginRankingLoss< InputDataType, OutputDataType >::serialize().

◆ OutputParameter() [1/2]

OutputDataType& OutputParameter ( ) const
inline

Get the output parameter.

Definition at line 73 of file margin_ranking_loss.hpp.

◆ OutputParameter() [2/2]

OutputDataType& OutputParameter ( )
inline

Modify the output parameter.

Definition at line 75 of file margin_ranking_loss.hpp.

◆ serialize()

void serialize ( Archive &  ar,
const unsigned  int 
)

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