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;
165 #include "poisson_nll_loss_impl.hpp" OutputDataType & OutputParameter()
Modify the output parameter.
bool & Full()
Modify the value of full.
Implementation of the Poisson negative log likelihood loss.
InputDataType::elem_type Eps() const
Get the value of eps.
Linear algebra utility functions, generally performed on matrices or vectors.
bool & Mean()
Modify the value of mean.
InputDataType::elem_type Forward(const PredictionType &prediction, const TargetType &target)
Computes the Poisson negative log likelihood Loss.
InputDataType & InputParameter() const
Get the input parameter.
The core includes that mlpack expects; standard C++ includes and Armadillo.
bool Full() const
Get the value of full.
OutputDataType & OutputParameter() const
Get the output parameter.
bool Mean() const
Get the value of mean.
bool LogInput() const
Get the value of logInput.
void serialize(Archive &ar, const uint32_t)
Serialize the layer.
InputDataType::elem_type & Eps()
Modify the value of eps.
static MLPACK_EXPORT util::PrefixedOutStream Fatal
Prints fatal messages prefixed with [FATAL], then terminates the program.
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.
bool & LogInput()
Modify the value of logInput.
void Backward(const PredictionType &prediction, const TargetType &target, LossType &loss)
Ordinary feed backward pass of a neural network.
InputDataType & InputParameter()
Modify the input parameter.