mlpack 3.4.2
Public Member Functions | List of all members
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. More...
 
template<typename InputType , typename TargetType , typename OutputType >
void Backward (const InputType &input, const TargetType &target, OutputType &output)
 Ordinary feed backward pass of a neural network. More...
 
OutputDataType & Delta ()
 Modify the delta. More...
 
OutputDataType & Delta () const
 Get the delta. More...
 
template<typename InputType , typename TargetType >
InputType::elem_type Forward (const InputType &input, const TargetType &target)
 Computes the Negative log likelihood. More...
 
InputDataType & InputParameter ()
 Modify the input parameter. More...
 
InputDataType & InputParameter () const
 Get the input parameter. More...
 
OutputDataType & OutputParameter ()
 Modify the output parameter. More...
 
OutputDataType & OutputParameter () const
 Get the output parameter. More...
 
template<typename Archive >
void serialize (Archive &, const unsigned int)
 Serialize the layer. More...
 

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).

Definition at line 35 of file negative_log_likelihood.hpp.

Constructor & Destructor Documentation

◆ NegativeLogLikelihood()

Create the NegativeLogLikelihoodLayer object.

Member Function Documentation

◆ Backward()

void Backward ( const InputType &  input,
const TargetType &  target,
OutputType &  output 
)

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
inputThe propagated input activation.
targetThe target vector, that contains the class index in the range between 1 and the number of classes.
outputThe calculated error.

◆ Delta() [1/2]

OutputDataType & Delta ( )
inline

Modify the delta.

Definition at line 83 of file negative_log_likelihood.hpp.

◆ Delta() [2/2]

OutputDataType & Delta ( ) const
inline

Get the delta.

Definition at line 81 of file negative_log_likelihood.hpp.

◆ Forward()

InputType::elem_type Forward ( const InputType &  input,
const TargetType &  target 
)

Computes the Negative log likelihood.

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

◆ InputParameter() [1/2]

InputDataType & InputParameter ( )
inline

Modify the input parameter.

Definition at line 73 of file negative_log_likelihood.hpp.

◆ InputParameter() [2/2]

InputDataType & InputParameter ( ) const
inline

Get the input parameter.

Definition at line 71 of file negative_log_likelihood.hpp.

◆ OutputParameter() [1/2]

OutputDataType & OutputParameter ( )
inline

Modify the output parameter.

Definition at line 78 of file negative_log_likelihood.hpp.

◆ OutputParameter() [2/2]

OutputDataType & OutputParameter ( ) const
inline

Get the output parameter.

Definition at line 76 of file negative_log_likelihood.hpp.

◆ serialize()

void serialize ( Archive &  ,
const unsigned int   
)

Serialize the layer.


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