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

The SigmoidCrossEntropyError performance function measures the network's performance according to the cross-entropy function between the input and target distributions. More...

#include <sigmoid_cross_entropy_error.hpp>

Public Member Functions

 SigmoidCrossEntropyError ()
 Create the SigmoidCrossEntropyError object.
 
template<typename PredictionType , typename TargetType >
PredictionType::elem_type Forward (const PredictionType &prediction, const TargetType &target)
 Computes the Sigmoid CrossEntropy Error functions. 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.
 
template<typename Archive >
void serialize (Archive &ar, const uint32_t)
 Serialize the layer.
 

Detailed Description

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

The SigmoidCrossEntropyError performance function measures the network's performance according to the cross-entropy function between the input and target distributions.

This function calculates the cross entropy given the real values instead of providing the sigmoid activations. The function uses this equivalent formulation: \(max(x, 0) - x * z + \log(1 + e^{-|x|})\) where x = input and z = target.

For more information, see the following paper.

@article{Janocha2017
title = {On Loss Functions for Deep Neural Networks in Classification},
author = {Katarzyna Janocha, Wojciech Marian Czarnecki},
url = {http://arxiv.org/abs/1702.05659},
journal = {CoRR},
eprint = {arXiv:1702.05659},
year = {2017}
}
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::SigmoidCrossEntropyError< InputDataType, OutputDataType >::Backward ( const PredictionType &  prediction,
const TargetType &  target,
LossType &  loss 
)
inline

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::SigmoidCrossEntropyError< InputDataType, OutputDataType >::Forward ( const PredictionType &  prediction,
const TargetType &  target 
)
inline

Computes the Sigmoid CrossEntropy Error functions.

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

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