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);
62 template<
typename InputType,
typename TargetType>
63 typename InputDataType::elem_type
Forward(
const InputType& input,
64 const TargetType& target);
77 template<
typename InputType,
typename TargetType,
typename OutputType>
79 const TargetType& target,
101 bool Full()
const {
return full; }
108 typename InputDataType::elem_type
Eps()
const {
return eps; }
111 typename InputDataType::elem_type&
Eps() {
return eps; }
115 bool Mean()
const {
return mean; }
123 template<
typename Archive>
128 template<
typename eT>
129 void CheckProbs(
const arma::Mat<eT>& probs)
131 for (
size_t i = 0; i < probs.size(); ++i)
133 if (probs[i] > 1.0 || probs[i] < 0.0)
134 Log::Fatal <<
"Probabilities cannot be greater than 1 "
135 <<
"or smaller than 0." << std::endl;
140 InputDataType inputParameter;
143 OutputDataType outputParameter;
153 typename InputDataType::elem_type eps;
163#include "poisson_nll_loss_impl.hpp"
static MLPACK_EXPORT util::PrefixedOutStream Fatal
Prints fatal messages prefixed with [FATAL], then terminates the program.
Implementation of the Poisson negative log likelihood loss.
InputDataType::elem_type Forward(const InputType &input, const TargetType &target)
Computes the Poisson negative log likelihood Loss.
InputDataType & InputParameter() const
Get the input parameter.
bool & Mean()
Modify the value of mean.
InputDataType & InputParameter()
Modify the input parameter.
OutputDataType & OutputParameter() const
Get the output parameter.
bool & Full()
Modify the value of full.
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.
void Backward(const InputType &input, const TargetType &target, OutputType &output)
Ordinary feed backward pass of a neural network.
InputDataType::elem_type & Eps()
Modify the value of eps.
bool LogInput() const
Get the value of logInput.
InputDataType::elem_type Eps() const
Get the value of eps.
bool Mean() const
Get the value of mean.
bool Full() const
Get the value of full.
OutputDataType & OutputParameter()
Modify the output parameter.
bool & LogInput()
Modify the value of logInput.
void serialize(Archive &ar, const unsigned int)
Serialize the layer.
Linear algebra utility functions, generally performed on matrices or vectors.
The core includes that mlpack expects; standard C++ includes and Armadillo.