13 #ifndef MLPACK_METHODS_ANN_LOSS_FUNCTIONS_POISSON_NLL_LOSS_HPP 14 #define MLPACK_METHODS_ANN_LOSS_FUNCTIONS_POISSON_NLL_LOSS_HPP 33 typename InputDataType = arma::mat,
34 typename OutputDataType = arma::mat
51 const bool full =
false,
52 const typename InputDataType::elem_type eps = 1e-08,
53 const bool mean =
true);
63 template<
typename PredictionType,
typename TargetType>
64 typename InputDataType::elem_type
Forward(
const PredictionType& prediction,
65 const TargetType& target);
79 template<
typename PredictionType,
typename TargetType,
typename LossType>
80 void Backward(
const PredictionType& prediction,
81 const TargetType& target,
103 bool Full()
const {
return full; }
110 typename InputDataType::elem_type
Eps()
const {
return eps; }
113 typename InputDataType::elem_type&
Eps() {
return eps; }
117 bool Mean()
const {
return mean; }
125 template<
typename Archive>
126 void serialize(Archive& ar,
const uint32_t );
130 template<
typename eT>
131 void CheckProbs(
const arma::Mat<eT>& probs)
133 for (
size_t i = 0; i < probs.size(); ++i)
135 if (probs[i] > 1.0 || probs[i] < 0.0)
136 Log::Fatal <<
"Probabilities cannot be greater than 1 " 137 <<
"or smaller than 0." << std::endl;
142 InputDataType inputParameter;
145 OutputDataType outputParameter;
155 typename InputDataType::elem_type eps;
Implementation of the Poisson negative log likelihood loss.
Definition: poisson_nll_loss.hpp:36
void serialize(Archive &ar, const uint32_t)
Serialize the layer.
Definition: poisson_nll_loss_impl.hpp:84
static MLPACK_EXPORT util::PrefixedOutStream Fatal
Prints fatal messages prefixed with [FATAL], then terminates the program.
Definition: log.hpp:90
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
InputDataType::elem_type Forward(const PredictionType &prediction, const TargetType &target)
Computes the Poisson negative log likelihood Loss.
Definition: poisson_nll_loss_impl.hpp:39
The core includes that mlpack expects; standard C++ includes and Armadillo.
InputDataType & InputParameter()
Modify the input parameter.
Definition: poisson_nll_loss.hpp:87
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.
Definition: poisson_nll_loss_impl.hpp:23
bool LogInput() const
Get the value of logInput.
Definition: poisson_nll_loss.hpp:96
bool & LogInput()
Modify the value of logInput.
Definition: poisson_nll_loss.hpp:99
void Backward(const PredictionType &prediction, const TargetType &target, LossType &loss)
Ordinary feed backward pass of a neural network.
Definition: poisson_nll_loss_impl.hpp:66
bool Full() const
Get the value of full.
Definition: poisson_nll_loss.hpp:103
bool & Full()
Modify the value of full.
Definition: poisson_nll_loss.hpp:106
bool & Mean()
Modify the value of mean.
Definition: poisson_nll_loss.hpp:120
InputDataType::elem_type Eps() const
Get the value of eps.
Definition: poisson_nll_loss.hpp:110
bool Mean() const
Get the value of mean.
Definition: poisson_nll_loss.hpp:117
OutputDataType & OutputParameter() const
Get the output parameter.
Definition: poisson_nll_loss.hpp:90
InputDataType::elem_type & Eps()
Modify the value of eps.
Definition: poisson_nll_loss.hpp:113
InputDataType & InputParameter() const
Get the input parameter.
Definition: poisson_nll_loss.hpp:85
OutputDataType & OutputParameter()
Modify the output parameter.
Definition: poisson_nll_loss.hpp:92