BCELoss< InputDataType, OutputDataType > Class Template Reference

The binary-cross-entropy performance function measures the Binary Cross Entropy between the target and the output. More...

Public Member Functions

 BCELoss (const double eps=1e-10, const bool reduction=true)
 Create the BinaryCrossEntropyLoss object. 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...

 
double Eps () const
 Get the epsilon. More...

 
double & Eps ()
 Modify the epsilon. More...

 
template
<
typename
PredictionType
,
typename
TargetType
>
PredictionType::elem_type Forward (const PredictionType &prediction, const TargetType &target)
 Computes the cross-entropy function. More...

 
OutputDataType & OutputParameter () const
 Get the output parameter. More...

 
OutputDataType & OutputParameter ()
 Modify the output parameter. More...

 
bool Reduction () const
 Get the reduction. More...

 
bool & Reduction ()
 Set the reduction. More...

 
template
<
typename
Archive
>
void serialize (Archive &ar, const uint32_t)
 Serialize the layer. More...

 

Detailed Description


template
<
typename
InputDataType
=
arma::mat
,
typename
OutputDataType
=
arma::mat
>

class mlpack::ann::BCELoss< InputDataType, OutputDataType >

The binary-cross-entropy performance function measures the Binary Cross Entropy between the target and the output.

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 33 of file binary_cross_entropy_loss.hpp.

Constructor & Destructor Documentation

◆ BCELoss()

BCELoss ( const double  eps = 1e-10,
const bool  reduction = true 
)

Create the BinaryCrossEntropyLoss object.

Parameters
epsThe minimum value used for computing logarithms and denominators in a numerically stable way.
reductionReduction type. If true, it returns the mean of the loss. Else, it returns the sum.

Member Function Documentation

◆ Backward()

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

◆ Eps() [1/2]

double Eps ( ) const
inline

Get the epsilon.

Definition at line 76 of file binary_cross_entropy_loss.hpp.

◆ Eps() [2/2]

double& Eps ( )
inline

Modify the epsilon.

Definition at line 78 of file binary_cross_entropy_loss.hpp.

◆ Forward()

PredictionType::elem_type Forward ( const PredictionType &  prediction,
const TargetType &  target 
)

Computes the cross-entropy function.

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

◆ OutputParameter() [1/2]

OutputDataType& OutputParameter ( ) const
inline

Get the output parameter.

Definition at line 71 of file binary_cross_entropy_loss.hpp.

◆ OutputParameter() [2/2]

OutputDataType& OutputParameter ( )
inline

Modify the output parameter.

Definition at line 73 of file binary_cross_entropy_loss.hpp.

◆ Reduction() [1/2]

bool Reduction ( ) const
inline

Get the reduction.

Definition at line 81 of file binary_cross_entropy_loss.hpp.

◆ Reduction() [2/2]

bool& Reduction ( )
inline

Set the reduction.

Definition at line 83 of file binary_cross_entropy_loss.hpp.

References BCELoss< InputDataType, OutputDataType >::serialize().

◆ serialize()

void serialize ( Archive &  ar,
const uint32_t   
)

Serialize the layer.

Referenced by BCELoss< InputDataType, OutputDataType >::Reduction().


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