mlpack
|
Margin ranking loss measures the loss given inputs and a label vector with values of 1 or -1. More...
#include <margin_ranking_loss.hpp>
Public Member Functions | |
MarginRankingLoss (const double margin=1.0) | |
Create the MarginRankingLoss object with Hyperparameter margin. More... | |
template<typename PredictionType , typename TargetType > | |
PredictionType::elem_type | Forward (const PredictionType &prediction, const TargetType &target) |
Computes the Margin Ranking Loss function. 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... | |
OutputDataType & | OutputParameter () const |
Get the output parameter. | |
OutputDataType & | OutputParameter () |
Modify the output parameter. | |
double | Margin () const |
Get the margin parameter. | |
double & | Margin () |
Modify the margin parameter. | |
template<typename Archive > | |
void | serialize (Archive &ar, const uint32_t) |
Serialize the layer. | |
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). |
mlpack::ann::MarginRankingLoss< InputDataType, OutputDataType >::MarginRankingLoss | ( | const double | margin = 1.0 | ) |
Create the MarginRankingLoss object with Hyperparameter margin.
Hyperparameter margin defines a minimum distance between correctly ranked samples.
void mlpack::ann::MarginRankingLoss< InputDataType, OutputDataType >::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 mlpack::ann::MarginRankingLoss< InputDataType, OutputDataType >::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. |