mlpack
Public Member Functions | List of all members
mlpack::ann::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 PredictionType , typename TargetType >
PredictionType::elem_type Forward (const PredictionType &prediction, const TargetType &target)
 Computes the Kullback–Leibler divergence error function. 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...
 
OutputDataType & OutputParameter () const
 Get the output parameter.
 
OutputDataType & OutputParameter ()
 Modify the output parameter.
 
bool TakeMean () const
 Get the value of takeMean.
 
bool & TakeMean ()
 Modify the value of takeMean.
 
template<typename Archive >
void serialize (Archive &ar, const uint32_t)
 Serialize the loss function.
 

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

Constructor & Destructor Documentation

◆ KLDivergence()

template<typename InputDataType , typename OutputDataType >
mlpack::ann::KLDivergence< InputDataType, OutputDataType >::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()

template<typename InputDataType , typename OutputDataType >
template<typename PredictionType , typename TargetType , typename LossType >
void mlpack::ann::KLDivergence< InputDataType, OutputDataType >::Backward ( const PredictionType &  prediction,
const TargetType &  target,
LossType &  loss 
)

Ordinary feed backward pass of a neural network.

Parameters
predictionPredictions used for evaluating the specified loss function.
targetThe target vector.
lossThe calculated error.

◆ Forward()

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

Computes the Kullback–Leibler divergence error function.

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

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