MinkowskiError Class Reference

This class represents the Minkowski error term. More...

#include <minkowski_error.h>

Inheritance diagram for MinkowskiError:
LossIndex

Public Member Functions

 MinkowskiError ()
 
 MinkowskiError (NeuralNetwork *, DataSet *)
 
virtual ~MinkowskiError ()
 
type get_Minkowski_parameter () const
 Returns the Minkowski exponent value used to calculate the error. More...
 
void set_default ()
 
void set_Minkowski_parameter (const type &)
 
void calculate_error (const DataSetBatch &batch, const NeuralNetworkForwardPropagation &forward_propagation, LossIndexBackPropagation &back_propagation) const
 MinkowskiError::calculate_error. More...
 
void calculate_output_delta (const DataSetBatch &, NeuralNetworkForwardPropagation &, LossIndexBackPropagation &) const
 
string get_error_type () const
 Returns a string with the name of the Minkowski error loss type, "MINKOWSKI_ERROR". More...
 
string get_error_type_text () const
 Returns a string with the name of the Minkowski error loss type in text format. More...
 
void from_XML (const tinyxml2::XMLDocument &)
 
void write_XML (tinyxml2::XMLPrinter &) const
 
- Public Member Functions inherited from LossIndex
 LossIndex ()
 
 LossIndex (NeuralNetwork *, DataSet *)
 
virtual ~LossIndex ()
 Destructor. More...
 
NeuralNetworkget_neural_network_pointer () const
 Returns a pointer to the neural network object associated to the error term. More...
 
DataSetget_data_set_pointer () const
 Returns a pointer to the data set object associated to the error term. More...
 
const type & get_regularization_weight () const
 Returns regularization weight. More...
 
const bool & get_display () const
 
bool has_neural_network () const
 
bool has_data_set () const
 
RegularizationMethod get_regularization_method () const
 Returns the regularization method. More...
 
void set ()
 
void set (NeuralNetwork *)
 
void set (DataSet *)
 
void set (NeuralNetwork *, DataSet *)
 
void set (const LossIndex &)
 
void set_threads_number (const int &)
 
void set_neural_network_pointer (NeuralNetwork *)
 
virtual void set_data_set_pointer (DataSet *)
 Sets a new data set on which the error term is to be measured. More...
 
void set_default ()
 Sets the members of the error term to their default values: More...
 
void set_regularization_method (const RegularizationMethod &)
 
void set_regularization_method (const string &)
 
void set_regularization_weight (const type &)
 
void set_display (const bool &)
 
virtual void set_normalization_coefficient ()
 
bool has_selection () const
 Returns true if there are selection samples and false otherwise. More...
 
type calculate_eta () const
 
type calculate_h (const type &) const
 
Tensor< type, 1 > calculate_gradient_numerical_differentiation ()
 
Tensor< type, 2 > calculate_jacobian_numerical_differentiation ()
 
void calculate_errors (const DataSetBatch &, const NeuralNetworkForwardPropagation &, LossIndexBackPropagation &) const
 
void calculate_layers_delta (const DataSetBatch &, NeuralNetworkForwardPropagation &, LossIndexBackPropagation &) const
 
void calculate_error_gradient (const DataSetBatch &, const NeuralNetworkForwardPropagation &, LossIndexBackPropagation &) const
 
void back_propagate (const DataSetBatch &, NeuralNetworkForwardPropagation &, LossIndexBackPropagation &) const
 
void calculate_errors_lm (const DataSetBatch &, const NeuralNetworkForwardPropagation &, LossIndexBackPropagationLM &) const
 
virtual void calculate_squared_errors_lm (const DataSetBatch &, const NeuralNetworkForwardPropagation &, LossIndexBackPropagationLM &) const
 
virtual void calculate_error_lm (const DataSetBatch &, const NeuralNetworkForwardPropagation &, LossIndexBackPropagationLM &) const
 
virtual void calculate_output_delta_lm (const DataSetBatch &, NeuralNetworkForwardPropagation &, LossIndexBackPropagationLM &) const
 
void calculate_layers_delta_lm (const DataSetBatch &, NeuralNetworkForwardPropagation &, LossIndexBackPropagationLM &) const
 
virtual void calculate_error_gradient_lm (const DataSetBatch &, LossIndexBackPropagationLM &) const
 
void calculate_squared_errors_jacobian_lm (const DataSetBatch &, NeuralNetworkForwardPropagation &, LossIndexBackPropagationLM &) const
 
virtual void calculate_error_hessian_lm (const DataSetBatch &, LossIndexBackPropagationLM &) const
 
void back_propagate_lm (const DataSetBatch &, NeuralNetworkForwardPropagation &, LossIndexBackPropagationLM &) const
 
type calculate_regularization (const Tensor< type, 1 > &) const
 
void calculate_regularization_gradient (const Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void calculate_regularization_hessian (const Tensor< type, 1 > &, Tensor< type, 2 > &) const
 
void from_XML (const tinyxml2::XMLDocument &)
 
void regularization_from_XML (const tinyxml2::XMLDocument &)
 
void write_regularization_XML (tinyxml2::XMLPrinter &) const
 
string write_regularization_method () const
 
void check () const
 

Private Attributes

type minkowski_parameter
 Minkowski exponent value. More...
 

Additional Inherited Members

- Public Types inherited from LossIndex
enum class  RegularizationMethod { L1 , L2 , NoRegularization }
 Enumeration of available regularization methods. More...
 
- Protected Attributes inherited from LossIndex
NonBlockingThreadPool * non_blocking_thread_pool = nullptr
 
ThreadPoolDevice * thread_pool_device = nullptr
 
NeuralNetworkneural_network_pointer = nullptr
 Pointer to a neural network object. More...
 
DataSetdata_set_pointer = nullptr
 Pointer to a data set object. More...
 
RegularizationMethod regularization_method = RegularizationMethod::L2
 Pointer to a regularization method object. More...
 
type regularization_weight = static_cast<type>(0.01)
 Regularization weight value. More...
 
bool display = true
 Display messages to screen. More...
 
const Eigen::array< IndexPair< Index >, 1 > AT_B = {IndexPair<Index>(0, 0)}
 
const Eigen::array< IndexPair< Index >, 1 > A_B = {IndexPair<Index>(1, 0)}
 
const Eigen::array< IndexPair< Index >, 2 > SSE = {IndexPair<Index>(0, 0), IndexPair<Index>(1, 1)}
 
const Eigen::array< int, 1 > rows_sum = {Eigen::array<int, 1>({1})}
 

Detailed Description

This class represents the Minkowski error term.

The Minkowski error measures the difference between the outputs of a neural network and the targets in a data set. This error term is used in data modeling problems. It can be more useful when the data set presents outliers.

Definition at line 36 of file minkowski_error.h.

Constructor & Destructor Documentation

◆ MinkowskiError() [1/2]

MinkowskiError ( )
explicit

Default constructor. It creates Minkowski error term not associated to any neural network and not measured on any data set. It also initializes all the rest of class members to their default values.

Definition at line 18 of file minkowski_error.cpp.

◆ MinkowskiError() [2/2]

MinkowskiError ( NeuralNetwork new_neural_network_pointer,
DataSet new_data_set_pointer 
)
explicit

Neural network and data set constructor. It creates a Minkowski error term object associated to a neural network and measured on a data set. It also initializes all the rest of class members to their default values.

Parameters
new_neural_network_pointerPointer to a neural network object.
new_data_set_pointerPointer to a data set object.

Definition at line 30 of file minkowski_error.cpp.

◆ ~MinkowskiError()

~MinkowskiError ( )
virtual

Destructor. It does not delete any pointer.

Definition at line 40 of file minkowski_error.cpp.

Member Function Documentation

◆ calculate_error()

void calculate_error ( const DataSetBatch batch,
const NeuralNetworkForwardPropagation forward_propagation,
LossIndexBackPropagation back_propagation 
) const
virtual

MinkowskiError::calculate_error.

Parameters
batch
forward_propagation
back_propagation
Todo:
Divide by number of samples.

Implements LossIndex.

Definition at line 98 of file minkowski_error.cpp.

◆ calculate_output_delta()

void calculate_output_delta ( const DataSetBatch batch,
NeuralNetworkForwardPropagation ,
LossIndexBackPropagation back_propagation 
) const
virtual

Implements LossIndex.

Definition at line 113 of file minkowski_error.cpp.

◆ from_XML()

void from_XML ( const tinyxml2::XMLDocument document)

Loads a Minkowski error object from a XML document.

Parameters
documentTinyXML document containing the members of the object.

Definition at line 261 of file minkowski_error.cpp.

◆ get_error_type()

string get_error_type ( ) const
virtual

Returns a string with the name of the Minkowski error loss type, "MINKOWSKI_ERROR".

Reimplemented from LossIndex.

Definition at line 216 of file minkowski_error.cpp.

◆ get_error_type_text()

string get_error_type_text ( ) const
virtual

Returns a string with the name of the Minkowski error loss type in text format.

Reimplemented from LossIndex.

Definition at line 224 of file minkowski_error.cpp.

◆ get_Minkowski_parameter()

type get_Minkowski_parameter ( ) const

Returns the Minkowski exponent value used to calculate the error.

Definition at line 47 of file minkowski_error.cpp.

◆ set_default()

void set_default ( )

Sets the default values to a Minkowski error object:

  • Minkowski parameter: 1.5.
  • Display: true.

Definition at line 59 of file minkowski_error.cpp.

◆ set_Minkowski_parameter()

void set_Minkowski_parameter ( const type &  new_Minkowski_parameter)

Sets a new Minkowski exponent value to be used in order to calculate the error. The Minkowski R-value must be comprised between 1 and 2.

Parameters
new_Minkowski_parameterMinkowski exponent value.

Definition at line 71 of file minkowski_error.cpp.

◆ write_XML()

void write_XML ( tinyxml2::XMLPrinter file_stream) const
virtual

Serializes the cross entropy error object into a XML document of the TinyXML library without keep the DOM tree in memory. See the OpenNN manual for more information about the format of this document

Reimplemented from LossIndex.

Definition at line 233 of file minkowski_error.cpp.

Member Data Documentation

◆ minkowski_parameter

type minkowski_parameter
private

Minkowski exponent value.

Definition at line 84 of file minkowski_error.h.


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