SumSquaredError Class Reference

This class represents the sum squared peformance term functional. More...

#include <sum_squared_error.h>

Inheritance diagram for SumSquaredError:
LossIndex

Public Member Functions

 SumSquaredError ()
 
 SumSquaredError (NeuralNetwork *, DataSet *)
 
virtual ~SumSquaredError ()
 Destructor. More...
 
void calculate_error (const DataSetBatch &, const NeuralNetworkForwardPropagation &, LossIndexBackPropagation &) const
 
void calculate_output_delta (const DataSetBatch &, NeuralNetworkForwardPropagation &, LossIndexBackPropagation &) const
 
void calculate_error_lm (const DataSetBatch &, const NeuralNetworkForwardPropagation &, LossIndexBackPropagationLM &) const
 
void calculate_output_delta_lm (const DataSetBatch &, NeuralNetworkForwardPropagation &, LossIndexBackPropagationLM &) const
 
void calculate_error_gradient_lm (const DataSetBatch &, LossIndexBackPropagationLM &) const
 
void calculate_error_hessian_lm (const DataSetBatch &, LossIndexBackPropagationLM &) const
 
string get_error_type () const
 Returns a string with the name of the sum squared error loss type, "SUM_SQUARED_ERROR". More...
 
string get_error_type_text () const
 Returns a string with the name of the sum squared 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
 
void calculate_layers_delta_lm (const DataSetBatch &, NeuralNetworkForwardPropagation &, LossIndexBackPropagationLM &) const
 
void calculate_squared_errors_jacobian_lm (const DataSetBatch &, NeuralNetworkForwardPropagation &, 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
 

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 sum squared peformance term functional.

This is used as the error term in data modeling problems, such as function regression, classification or time series prediction.

Definition at line 37 of file sum_squared_error.h.

Constructor & Destructor Documentation

◆ SumSquaredError() [1/2]

SumSquaredError ( )
explicit

Default constructor. It creates a sum squared 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 sum_squared_error.cpp.

◆ SumSquaredError() [2/2]

SumSquaredError ( NeuralNetwork new_neural_network_pointer,
DataSet new_data_set_pointer 
)
explicit

Neural network and data set constructor. It creates a sum squared error 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 29 of file sum_squared_error.cpp.

◆ ~SumSquaredError()

~SumSquaredError ( )
virtual

Destructor.

Definition at line 37 of file sum_squared_error.cpp.

Member Function Documentation

◆ calculate_error()

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

Implements LossIndex.

Definition at line 42 of file sum_squared_error.cpp.

◆ calculate_error_gradient_lm()

void calculate_error_gradient_lm ( const DataSetBatch ,
LossIndexBackPropagationLM loss_index_back_propagation_lm 
) const
virtual

Reimplemented from LossIndex.

Definition at line 184 of file sum_squared_error.cpp.

◆ calculate_error_hessian_lm()

void calculate_error_hessian_lm ( const DataSetBatch ,
LossIndexBackPropagationLM loss_index_back_propagation_lm 
) const
virtual

Reimplemented from LossIndex.

Definition at line 203 of file sum_squared_error.cpp.

◆ calculate_error_lm()

void calculate_error_lm ( const DataSetBatch ,
const NeuralNetworkForwardPropagation ,
LossIndexBackPropagationLM back_propagation 
) const
virtual

Reimplemented from LossIndex.

Definition at line 54 of file sum_squared_error.cpp.

◆ calculate_output_delta()

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

Implements LossIndex.

Definition at line 66 of file sum_squared_error.cpp.

◆ calculate_output_delta_lm()

void calculate_output_delta_lm ( const DataSetBatch ,
NeuralNetworkForwardPropagation ,
LossIndexBackPropagationLM loss_index_back_propagation 
) const
virtual

Reimplemented from LossIndex.

Definition at line 127 of file sum_squared_error.cpp.

◆ from_XML()

void from_XML ( const tinyxml2::XMLDocument document)

Loads a sum squared error object from a XML document.

Parameters
documentTinyXML document containing the members of the object.

Definition at line 254 of file sum_squared_error.cpp.

◆ get_error_type()

string get_error_type ( ) const
virtual

Returns a string with the name of the sum squared error loss type, "SUM_SQUARED_ERROR".

Reimplemented from LossIndex.

Definition at line 224 of file sum_squared_error.cpp.

◆ get_error_type_text()

string get_error_type_text ( ) const
virtual

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

Reimplemented from LossIndex.

Definition at line 232 of file sum_squared_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 241 of file sum_squared_error.cpp.


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