Implementation of the Poisson negative log likelihood loss. More...
Public Member Functions | |
PoissonNLLLoss (const bool logInput=true, const bool full=false, const typename InputDataType::elem_type eps=1e-08, const bool mean=true) | |
Create the PoissonNLLLoss 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... | |
InputDataType::elem_type | Eps () const |
Get the value of eps. More... | |
InputDataType::elem_type & | Eps () |
Modify the value of eps. More... | |
template < typename PredictionType , typename TargetType > | |
InputDataType::elem_type | Forward (const PredictionType &prediction, const TargetType &target) |
Computes the Poisson negative log likelihood Loss. More... | |
bool | Full () const |
Get the value of full. More... | |
bool & | Full () |
Modify the value of full. More... | |
InputDataType & | InputParameter () const |
Get the input parameter. More... | |
InputDataType & | InputParameter () |
Modify the input parameter. More... | |
bool | LogInput () const |
Get the value of logInput. More... | |
bool & | LogInput () |
Modify the value of logInput. More... | |
bool | Mean () const |
Get the value of mean. More... | |
bool & | Mean () |
Modify the value of mean. 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... | |
Implementation of the Poisson negative log likelihood loss.
This loss function expects input for each class. It 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 36 of file poisson_nll_loss.hpp.
PoissonNLLLoss | ( | const bool | logInput = true , |
const bool | full = false , |
||
const typename InputDataType::elem_type | eps = 1e-08 , |
||
const bool | mean = true |
||
) |
Create the PoissonNLLLoss object.
logInput | If true the loss is computed as , if false then the loss is . |
full | Boolean value that determines whether to include Stirling's approximation term. |
eps | A small value to prevent 0 in denominators and logarithms. |
mean | When true, mean loss is computed otherwise total loss. |
void Backward | ( | const PredictionType & | prediction, |
const TargetType & | target, | ||
LossType & | loss | ||
) |
Ordinary feed backward pass of a neural network.
The Poisson Negative Log Likelihood loss function expects the input for each class. It 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 value of eps.
eps is a small value required to prevent 0 in logarithms and denominators.
Definition at line 110 of file poisson_nll_loss.hpp.
|
inline |
Modify the value of eps.
eps is a small value required to prevent 0 in logarithms and denominators.
Definition at line 113 of file poisson_nll_loss.hpp.
InputDataType::elem_type Forward | ( | const PredictionType & | prediction, |
const TargetType & | target | ||
) |
Computes the Poisson negative log likelihood Loss.
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. |
|
inline |
Get the value of full.
full is a boolean value that determines whether to include Stirling's approximation term.
Definition at line 103 of file poisson_nll_loss.hpp.
|
inline |
Modify the value of full.
full is a boolean value that determines whether to include Stirling's approximation term.
Definition at line 106 of file poisson_nll_loss.hpp.
|
inline |
Get the input parameter.
Definition at line 85 of file poisson_nll_loss.hpp.
|
inline |
Modify the input parameter.
Definition at line 87 of file poisson_nll_loss.hpp.
|
inline |
Get the value of logInput.
logInput is a boolean value that tells if logits are given as input.
Definition at line 96 of file poisson_nll_loss.hpp.
|
inline |
Modify the value of logInput.
logInput is a boolean value that tells if logits are given as input.
Definition at line 99 of file poisson_nll_loss.hpp.
|
inline |
Get the value of mean.
It's a boolean value that tells if mean of the total loss has to be taken.
Definition at line 117 of file poisson_nll_loss.hpp.
|
inline |
Modify the value of mean.
It's a boolean value that tells if mean of the total loss has to be taken.
Definition at line 120 of file poisson_nll_loss.hpp.
References Log::Fatal, and PoissonNLLLoss< InputDataType, OutputDataType >::serialize().
|
inline |
Get the output parameter.
Definition at line 90 of file poisson_nll_loss.hpp.
|
inline |
Modify the output parameter.
Definition at line 92 of file poisson_nll_loss.hpp.
void serialize | ( | Archive & | ar, |
const uint32_t | |||
) |
Serialize the layer.
Referenced by PoissonNLLLoss< InputDataType, OutputDataType >::Mean().