Implementation of the negative log likelihood layer. More...
Public Member Functions | |
NegativeLogLikelihood () | |
Create the NegativeLogLikelihoodLayer object. 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 & | Delta () const |
Get the delta. More... | |
OutputDataType & | Delta () |
Modify the delta. More... | |
template < typename PredictionType , typename TargetType > | |
PredictionType::elem_type | Forward (const PredictionType &prediction, const TargetType &target) |
Computes the Negative log likelihood. More... | |
InputDataType & | InputParameter () const |
Get the input parameter. More... | |
InputDataType & | InputParameter () |
Modify the input parameter. More... | |
OutputDataType & | OutputParameter () const |
Get the output parameter. More... | |
OutputDataType & | OutputParameter () |
Modify the output parameter. More... | |
template < typename Archive > | |
void | serialize (Archive &, const uint32_t) |
Serialize the layer. More... | |
Implementation of the negative log likelihood layer.
The negative log likelihood layer expectes that the input contains log-probabilities for each class. The layer also expects a class index, in the range between 1 and the number of classes, as target when calling the Forward function.
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 negative_log_likelihood.hpp.
Create the NegativeLogLikelihoodLayer object.
void Backward | ( | const PredictionType & | prediction, |
const TargetType & | target, | ||
LossType & | loss | ||
) |
Ordinary feed backward pass of a neural network.
The negative log likelihood layer expects that the input contains log-probabilities for each class. The layer also expects a class index, in the range between 1 and the number of classes, as target when calling the Forward function.
prediction | Predictions used for evaluating the specified loss function. |
target | The target vector, that contains the class index in the range between 1 and the number of classes. |
loss | The calculated error. |
|
inline |
Get the delta.
Definition at line 83 of file negative_log_likelihood.hpp.
|
inline |
Modify the delta.
Definition at line 85 of file negative_log_likelihood.hpp.
References NegativeLogLikelihood< InputDataType, OutputDataType >::serialize().
PredictionType::elem_type Forward | ( | const PredictionType & | prediction, |
const TargetType & | target | ||
) |
Computes the Negative log likelihood.
iprediction | Predictions used for evaluating the specified loss function. |
target | The target vector, that contains the class index in the range between 1 and the number of classes. |
|
inline |
Get the input parameter.
Definition at line 73 of file negative_log_likelihood.hpp.
|
inline |
Modify the input parameter.
Definition at line 75 of file negative_log_likelihood.hpp.
|
inline |
Get the output parameter.
Definition at line 78 of file negative_log_likelihood.hpp.
|
inline |
Modify the output parameter.
Definition at line 80 of file negative_log_likelihood.hpp.
void serialize | ( | Archive & | , |
const uint32_t | |||
) |
Serialize the layer.
Referenced by NegativeLogLikelihood< InputDataType, OutputDataType >::Delta().