mlpack 3.4.2
Public Member Functions | List of all members
KLDivergence< InputDataType, OutputDataType > Class Template Reference

The Kullback–Leibler divergence is often used for continuous distributions (direct regression). More...

#include <kl_divergence.hpp>

Public Member Functions

 KLDivergence (const bool takeMean=false)
 Create the Kullback–Leibler Divergence object with the specified parameters. 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...
 
template<typename InputType , typename TargetType >
InputType::elem_type Forward (const InputType &input, const TargetType &target)
 Computes the Kullback–Leibler divergence error function. More...
 
OutputDataType & OutputParameter ()
 Modify the output parameter. More...
 
OutputDataType & OutputParameter () const
 Get the output parameter. More...
 
template<typename Archive >
void serialize (Archive &ar, const unsigned int)
 Serialize the loss function. More...
 
bool & TakeMean ()
 Modify the value of takeMean. More...
 
bool TakeMean () const
 Get the value of takeMean. More...
 

Detailed Description

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

The Kullback–Leibler divergence is often used for continuous distributions (direct regression).

For more information, see the following paper.

article{Kullback1951,
title = {On Information and Sufficiency},
author = {S. Kullback, R.A. Leibler},
journal = {The Annals of Mathematical Statistics},
year = {1951}
}
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 45 of file kl_divergence.hpp.

Constructor & Destructor Documentation

◆ KLDivergence()

KLDivergence ( const bool  takeMean = false)

Create the Kullback–Leibler Divergence object with the specified parameters.

Parameters
takeMeanBoolean variable to specify whether to take mean or not.

Member Function Documentation

◆ Backward()

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

Ordinary feed backward pass of a neural network.

Parameters
inputThe propagated input activation.
targetThe target vector.
outputThe calculated error.

◆ Forward()

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

Computes the Kullback–Leibler divergence error function.

Parameters
inputInput data used for evaluating the specified function.
targetTarget data to compare with.

◆ OutputParameter() [1/2]

OutputDataType & OutputParameter ( )
inline

Modify the output parameter.

Definition at line 81 of file kl_divergence.hpp.

◆ OutputParameter() [2/2]

OutputDataType & OutputParameter ( ) const
inline

Get the output parameter.

Definition at line 79 of file kl_divergence.hpp.

◆ serialize()

void serialize ( Archive &  ar,
const unsigned int   
)

Serialize the loss function.

◆ TakeMean() [1/2]

bool & TakeMean ( )
inline

Modify the value of takeMean.

Definition at line 86 of file kl_divergence.hpp.

◆ TakeMean() [2/2]

bool TakeMean ( ) const
inline

Get the value of takeMean.

Definition at line 84 of file kl_divergence.hpp.


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