mlpack  3.4.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
SoftMarginLoss< InputDataType, OutputDataType > Class Template Reference

Public Member Functions

 SoftMarginLoss (const bool reduction=true)
 Create the SoftMarginLoss 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...
 
template<typename InputType , typename TargetType >
InputType::elem_type Forward (const InputType &input, const TargetType &target)
 Computes the Soft Margin Loss function. More...
 
OutputDataType & OutputParameter () const
 Get the output parameter. More...
 
OutputDataType & OutputParameter ()
 Modify the output parameter. More...
 
bool Reduction () const
 Get the type of reduction used. More...
 
bool & Reduction ()
 Modify the type of reduction used. More...
 
template<typename Archive >
void serialize (Archive &ar, const unsigned int)
 Serialize the layer. More...
 

Detailed Description

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

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 34 of file soft_margin_loss.hpp.

Constructor & Destructor Documentation

SoftMarginLoss ( const bool  reduction = true)

Create the SoftMarginLoss object.

Parameters
reductionSpecifies the reduction to apply to the output. If false, 'mean' reduction is used, where sum of the output will be divided by the number of elements in the output. If true, 'sum' reduction is used and the output will be summed. It is set to true by default.

Member Function Documentation

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.
InputType::elem_type Forward ( const InputType &  input,
const TargetType &  target 
)

Computes the Soft Margin Loss function.

Parameters
inputInput data used for evaluating the specified function.
targetThe target vector with same shape as input.
OutputDataType& OutputParameter ( ) const
inline

Get the output parameter.

Definition at line 71 of file soft_margin_loss.hpp.

OutputDataType& OutputParameter ( )
inline

Modify the output parameter.

Definition at line 73 of file soft_margin_loss.hpp.

bool Reduction ( ) const
inline

Get the type of reduction used.

Definition at line 76 of file soft_margin_loss.hpp.

bool& Reduction ( )
inline

Modify the type of reduction used.

Definition at line 78 of file soft_margin_loss.hpp.

void serialize ( Archive &  ar,
const unsigned  int 
)

Serialize the layer.


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