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... | |
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 InputType & | input, |
const TargetType & | target, | ||
OutputType & | output | ||
) |
Ordinary feed backward pass of a neural network.
input | The propagated concatenated input activation. |
target | The label vector which contains -1 or 1 values. |
output | The calculated error. |
InputType::elem_type Forward | ( | const InputType & | input, |
const TargetType & | target | ||
) |
Computes the Margin Ranking Loss function.
input | Concatenation of the two inputs for evaluating the specified function. |
target | The label vector which contains values of -1 or 1. |
|
inline |
Get the margin parameter.
Definition at line 78 of file margin_ranking_loss.hpp.
|
inline |
Modify the margin parameter.
Definition at line 80 of file margin_ranking_loss.hpp.
References MarginRankingLoss< InputDataType, OutputDataType >::serialize().
|
inline |
Get the output parameter.
Definition at line 73 of file margin_ranking_loss.hpp.
|
inline |
Modify the output parameter.
Definition at line 75 of file margin_ranking_loss.hpp.
void serialize | ( | Archive & | ar, |
const unsigned | int | ||
) |
Serialize the layer.
Referenced by MarginRankingLoss< InputDataType, OutputDataType >::Margin().