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 < typename PredictionType , typename TargetType , typename LossType > | |
void | Backward (const PredictionType &prediction, const TargetType &target, LossType &loss) |
Ordinary feed backward pass of a neural network. More... | |
template < typename PredictionType , typename TargetType > | |
PredictionType::elem_type | Forward (const PredictionType &prediction, 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 < typename Archive > | |
void | serialize (Archive &ar, const uint32_t) |
Serialize the layer. More... | |
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.
InputDataType | Type of the input data (arma::colvec, arma::mat, arma::sp_mat or arma::cube). |
OutputDataType | Type of the output data (arma::colvec, arma::mat, arma::sp_mat or arma::cube). |
Definition at line 35 of file margin_ranking_loss.hpp.
MarginRankingLoss | ( | const double | margin = 1.0 | ) |
Create the MarginRankingLoss object with Hyperparameter margin.
Hyperparameter margin defines a minimum distance between correctly ranked samples.
void Backward | ( | const PredictionType & | prediction, |
const TargetType & | target, | ||
LossType & | loss | ||
) |
Ordinary feed backward pass of a neural network.
prediction | Predictions used for evaluating the specified loss function. |
target | The label vector which contains -1 or 1 values. |
loss | The calculated error. |
PredictionType::elem_type Forward | ( | const PredictionType & | prediction, |
const TargetType & | target | ||
) |
Computes the Margin Ranking Loss function.
prediction | Predictions used for evaluating the specified loss function. |
target | The label vector which contains values of -1 or 1. |
|
inline |
Get the margin parameter.
Definition at line 79 of file margin_ranking_loss.hpp.
|
inline |
Modify the margin parameter.
Definition at line 81 of file margin_ranking_loss.hpp.
References MarginRankingLoss< InputDataType, OutputDataType >::serialize().
|
inline |
Get the output parameter.
Definition at line 74 of file margin_ranking_loss.hpp.
|
inline |
Modify the output parameter.
Definition at line 76 of file margin_ranking_loss.hpp.
void serialize | ( | Archive & | ar, |
const uint32_t | |||
) |
Serialize the layer.
Referenced by MarginRankingLoss< InputDataType, OutputDataType >::Margin().