mlpack
Public Member Functions | List of all members
mlpack::ann::NegativeLogLikelihood< InputDataType, OutputDataType > Class Template Reference

Implementation of the negative log likelihood layer. More...

#include <negative_log_likelihood.hpp>

Public Member Functions

 NegativeLogLikelihood ()
 Create the NegativeLogLikelihoodLayer object.
 
template<typename PredictionType , typename TargetType >
PredictionType::elem_type Forward (const PredictionType &prediction, const TargetType &target)
 Computes the Negative log likelihood. 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 & InputParameter () const
 Get the input parameter.
 
InputDataType & InputParameter ()
 Modify the input parameter.
 
OutputDataType & OutputParameter () const
 Get the output parameter.
 
OutputDataType & OutputParameter ()
 Modify the output parameter.
 
OutputDataType & Delta () const
 Get the delta.
 
OutputDataType & Delta ()
 Modify the delta.
 
template<typename Archive >
void serialize (Archive &, const uint32_t)
 Serialize the layer.
 

Detailed Description

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
class mlpack::ann::NegativeLogLikelihood< InputDataType, OutputDataType >

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.

Template Parameters
InputDataTypeType of the input data (arma::colvec, arma::mat, arma::sp_mat or arma::cube).
OutputDataTypeType of the output data (arma::colvec, arma::mat, arma::sp_mat or arma::cube).

Member Function Documentation

◆ Backward()

template<typename InputDataType , typename OutputDataType >
template<typename PredictionType , typename TargetType , typename LossType >
void mlpack::ann::NegativeLogLikelihood< InputDataType, OutputDataType >::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.

Parameters
predictionPredictions used for evaluating the specified loss function.
targetThe target vector, that contains the class index in the range between 1 and the number of classes.
lossThe calculated error.

◆ Forward()

template<typename InputDataType , typename OutputDataType >
template<typename PredictionType , typename TargetType >
PredictionType::elem_type mlpack::ann::NegativeLogLikelihood< InputDataType, OutputDataType >::Forward ( const PredictionType &  prediction,
const TargetType &  target 
)

Computes the Negative log likelihood.

Parameters
ipredictionPredictions used for evaluating the specified loss function.
targetThe target vector, that contains the class index in the range between 1 and the number of classes.

The documentation for this class was generated from the following files: