OpenNN  2.2
Open Neural Networks Library
Classes | Public Member Functions | Protected Attributes | List of all members
OpenNN::PerformanceTerm Class Referenceabstract

#include <performance_term.h>

Inheritance diagram for OpenNN::PerformanceTerm:
OpenNN::CrossEntropyError OpenNN::FinalSolutionsError OpenNN::IndependentParametersError OpenNN::InverseSumSquaredError OpenNN::MeanSquaredError OpenNN::MinkowskiError OpenNN::NeuralParametersNorm OpenNN::NormalizedSquaredError OpenNN::OutputsIntegrals OpenNN::RootMeanSquaredError OpenNN::SolutionsError OpenNN::SumSquaredError

Classes

struct  FirstOrderPerformance
 
struct  FirstOrderTerms
 
struct  SecondOrderPerformance
 
struct  ZerothOrderPerformance
 
struct  ZerothOrderTerms
 

Public Member Functions

 PerformanceTerm (void)
 
 PerformanceTerm (NeuralNetwork *)
 
 PerformanceTerm (DataSet *)
 
 PerformanceTerm (MathematicalModel *)
 
 PerformanceTerm (NeuralNetwork *, DataSet *)
 
 PerformanceTerm (NeuralNetwork *, MathematicalModel *)
 
 PerformanceTerm (NeuralNetwork *, MathematicalModel *, DataSet *)
 
 PerformanceTerm (const tinyxml2::XMLDocument &)
 
 PerformanceTerm (const PerformanceTerm &)
 
virtual ~PerformanceTerm (void)
 
virtual PerformanceTermoperator= (const PerformanceTerm &)
 
virtual bool operator== (const PerformanceTerm &) const
 
NeuralNetworkget_neural_network_pointer (void) const
 
MathematicalModelget_mathemtaical_model_pointer (void) const
 
DataSetget_data_set_pointer (void) const
 
NumericalDifferentiationget_numerical_differentiation_pointer (void) const
 
const bool & get_display (void) const
 
bool has_neural_network (void) const
 
bool has_mathematical_model (void) const
 
bool has_data_set (void) const
 
bool has_numerical_differentiation (void) const
 
virtual void set (void)
 
virtual void set (NeuralNetwork *)
 
virtual void set (DataSet *)
 
virtual void set (MathematicalModel *)
 
virtual void set (NeuralNetwork *, DataSet *)
 
virtual void set (NeuralNetwork *, MathematicalModel *)
 
virtual void set (NeuralNetwork *, MathematicalModel *, DataSet *)
 
void set (const PerformanceTerm &)
 
virtual void set_neural_network_pointer (NeuralNetwork *)
 
virtual void set_mathematical_model_pointer (MathematicalModel *)
 
virtual void set_data_set_pointer (DataSet *)
 
void set_numerical_differentiation_pointer (NumericalDifferentiation *)
 
virtual void set_default (void)
 
void set_display (const bool &)
 
void construct_numerical_differentiation (void)
 
void delete_numerical_differentiation_pointer (void)
 
virtual void check (void) const
 
Vector< Vector< double > > calculate_layers_delta (const Vector< Vector< double > > &, const Vector< double > &) const
 
Vector< Vector< double > > calculate_layers_delta (const Vector< Vector< double > > &, const Vector< double > &, const Vector< double > &) const
 
Matrix< Matrix< double > > calculate_interlayers_Delta (const Vector< Vector< double > > &, const Vector< Vector< double > > &, const Matrix< Matrix< double > > &, const Vector< double > &, const Matrix< double > &, const Vector< Vector< double > > &) const
 
Vector< double > calculate_point_gradient (const Vector< double > &, const Vector< Vector< double > > &, const Vector< Vector< double > > &) const
 
Vector< double > calculate_point_gradient (const Vector< Matrix< double > > &, const Vector< Vector< double > > &) const
 
Matrix< double > calculate_point_Hessian (const Vector< Vector< double > > &, const Vector< Vector< Vector< double > > > &, const Matrix< Matrix< double > > &, const Vector< Vector< double > > &, const Matrix< Matrix< double > > &) const
 
virtual double calculate_performance (void) const =0
 
virtual double calculate_performance (const Vector< double > &) const =0
 
virtual double calculate_generalization_performance (void) const
 
virtual Vector< double > calculate_gradient (void) const
 
virtual Vector< double > calculate_gradient (const Vector< double > &) const
 
virtual Matrix< double > calculate_Hessian (void) const
 
virtual Matrix< double > calculate_Hessian (const Vector< double > &) const
 
virtual Vector< double > calculate_terms (void) const
 
virtual Vector< double > calculate_terms (const Vector< double > &) const
 
virtual Matrix< double > calculate_terms_Jacobian (void) const
 
virtual PerformanceTerm::FirstOrderTerms calculate_first_order_terms (void) const
 
virtual std::string write_performance_term_type (void) const
 
virtual std::string write_information (void) const
 
virtual std::string to_string (void) const
 
virtual tinyxml2::XMLDocument * to_XML (void) const
 
virtual void from_XML (const tinyxml2::XMLDocument &)
 
size_t calculate_Kronecker_delta (const size_t &, const size_t &) const
 

Protected Attributes

NeuralNetworkneural_network_pointer
 
DataSetdata_set_pointer
 
MathematicalModelmathematical_model_pointer
 
NumericalDifferentiationnumerical_differentiation_pointer
 
bool display
 

Detailed Description

This class represents the concept of performance term. A performance term is a summand in the performance functional expression. Any derived class must implement the calculate_performance(void) method.

Definition at line 45 of file performance_term.h.

Constructor & Destructor Documentation

OpenNN::PerformanceTerm::PerformanceTerm ( void  )
explicit

Default constructor. It creates a default performance term object, with all pointers initialized to NULL. It also initializes all the rest of class members to their default values.

Definition at line 27 of file performance_term.cpp.

OpenNN::PerformanceTerm::PerformanceTerm ( NeuralNetwork new_neural_network_pointer)
explicit

Neural network constructor. It creates a performance term object associated to a neural network object. The rest of pointers are initialized to NULL. It also initializes all the rest of class members to their default values.

Parameters
new_neural_network_pointerPointer to a neural network object.

Definition at line 45 of file performance_term.cpp.

OpenNN::PerformanceTerm::PerformanceTerm ( DataSet new_data_set_pointer)
explicit

Data set constructor. It creates a performance term object associated to a given data set object. The rest of pointers are initialized to NULL. It also initializes all the rest of class members to their default values.

Parameters
new_data_set_pointerPointer to a data set object.

Definition at line 63 of file performance_term.cpp.

OpenNN::PerformanceTerm::PerformanceTerm ( MathematicalModel new_mathematical_model_pointer)
explicit

Mathematical model constructor. It creates a performance term object associated to a given mathematical model object. The rest of pointers are initialized to NULL. It also initializes all the rest of class members to their default values.

Parameters
new_mathematical_model_pointerPointer to a mathematical model object.

Definition at line 81 of file performance_term.cpp.

OpenNN::PerformanceTerm::PerformanceTerm ( NeuralNetwork new_neural_network_pointer,
DataSet new_data_set_pointer 
)
explicit

Neural network and data set constructor. It creates a performance term object associated to a neural network and to be measured on a data set. The rest of pointers are initialized to NULL. 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 100 of file performance_term.cpp.

OpenNN::PerformanceTerm::PerformanceTerm ( NeuralNetwork new_neural_network_pointer,
MathematicalModel new_mathematical_model_pointer 
)
explicit

Neural network and mathematical model constructor. It creates a performance term object associated to a neural network and to be measured on a mathematical model. The rest of pointers are initialized to NULL. It also initializes all the rest of class members to their default values.

Parameters
new_neural_network_pointerPointer to a neural network object.
new_mathematical_model_pointerPointer to a mathematical model object.

Definition at line 119 of file performance_term.cpp.

OpenNN::PerformanceTerm::PerformanceTerm ( NeuralNetwork new_neural_network_pointer,
MathematicalModel new_mathematical_model_pointer,
DataSet new_data_set_pointer 
)
explicit

Neural network, mathematical model and data set constructor. It creates a performance term object associated to a neural network and to be measured on both a mathematical model and a data set. The rest of pointers are initialized to NULL. It also initializes all the rest of class members to their default values.

Parameters
new_neural_network_pointerPointer to a neural network object.
new_mathematical_model_pointerPointer to a mathematical model object.
new_data_set_pointerPointer to a data set object.

Definition at line 139 of file performance_term.cpp.

OpenNN::PerformanceTerm::PerformanceTerm ( const tinyxml2::XMLDocument &  performance_term_document)
explicit

XML constructor. It creates a default performance term object, with all pointers initialized to NULL. It also loads all the rest of class members from a XML document.

Parameters
performance_term_documentPointer to a TinyXML document with the object data.

Definition at line 156 of file performance_term.cpp.

OpenNN::PerformanceTerm::PerformanceTerm ( const PerformanceTerm other_performance_term)

Copy constructor. It creates a copy of an existing performance term object.

Parameters
other_performance_termPerformance term object to be copied.

Definition at line 174 of file performance_term.cpp.

OpenNN::PerformanceTerm::~PerformanceTerm ( void  )
virtual

Destructor. It deletes the numerical differentiation object composing this performance term object.

Definition at line 199 of file performance_term.cpp.

Member Function Documentation

Vector< double > OpenNN::PerformanceTerm::calculate_gradient ( void  ) const
virtual

Returns the performance term gradient.

Returns the default gradient vector of the performance term. It uses numerical differentiation.

Reimplemented in OpenNN::IndependentParametersError, OpenNN::CrossEntropyError, OpenNN::MeanSquaredError, OpenNN::MinkowskiError, OpenNN::OutputsIntegrals, OpenNN::SumSquaredError, OpenNN::NormalizedSquaredError, OpenNN::RootMeanSquaredError, and OpenNN::NeuralParametersNorm.

Definition at line 1339 of file performance_term.cpp.

Vector< double > OpenNN::PerformanceTerm::calculate_gradient ( const Vector< double > &  parameters) const
virtual

Returns the default gradient vector of the performance term. It uses numerical differentiation.

Reimplemented in OpenNN::SumSquaredError, and OpenNN::NeuralParametersNorm.

Definition at line 1377 of file performance_term.cpp.

Matrix< double > OpenNN::PerformanceTerm::calculate_Hessian ( void  ) const
virtual
Matrix< double > OpenNN::PerformanceTerm::calculate_Hessian ( const Vector< double > &  parameters) const
virtual
Todo:

Reimplemented in OpenNN::SumSquaredError, and OpenNN::NeuralParametersNorm.

Definition at line 1432 of file performance_term.cpp.

Matrix< Matrix< double > > OpenNN::PerformanceTerm::calculate_interlayers_Delta ( const Vector< Vector< double > > &  layers_activation_derivative,
const Vector< Vector< double > > &  layers_activation_second_derivative,
const Matrix< Matrix< double > > &  interlayers_combination_combination_Jacobian_form,
const Vector< double > &  output_objective_gradient,
const Matrix< double > &  output_objective_Hessian,
const Vector< Vector< double > > &  layers_delta 
) const

Returns the second partial derivatives of the outputs objective function with respect to the combinations of two layers. That quantity is called interlayers Delta, and it is represented as a matrix of matrices.

Parameters
layers_activation_derivativeActivation derivatives of all layers in the multilayer perceptron
layers_activation_second_derivativeActivation second derivatives of all layers in the multilayer perceptron
interlayers_combination_combination_Jacobian_formMatrix of matrices containing the partial derivatives of all layers combinations with respect to all layers combinations.
output_objective_gradientGradient vector of the outputs objective function.
output_objective_HessianHessian matrix of the outputs objective function.
layers_deltaVector of vectors containing the partial derivatives of the outputs objective function with respect to the combinations of all layers.
Todo:

Definition at line 1082 of file performance_term.cpp.

size_t OpenNN::PerformanceTerm::calculate_Kronecker_delta ( const size_t &  a,
const size_t &  b 
) const

Returns the Knronecker delta of two integers a and b, which equals 1 if they are equal and 0 otherwise.

Parameters
aFirst integer.
bSecond integer.

Definition at line 1601 of file performance_term.cpp.

Vector< Vector< double > > OpenNN::PerformanceTerm::calculate_layers_delta ( const Vector< Vector< double > > &  layers_activation_derivative,
const Vector< double > &  output_objective_gradient 
) const

Returns the delta vector for all the layers in the multilayer perceptron The format of this quantity is a vector of vectors.

Parameters
layers_activation_derivativeForward propagation activation derivative.
output_objective_gradientGradient of the outputs objective function.

Definition at line 634 of file performance_term.cpp.

Vector< Vector< double > > OpenNN::PerformanceTerm::calculate_layers_delta ( const Vector< Vector< double > > &  layers_activation_derivative,
const Vector< double > &  homogeneous_solution,
const Vector< double > &  output_objective_gradient 
) const

Returns the delta vector for all the layers in the multilayer perceptron, when boundary conditions are imposed. The format of this quantity is a vector of vectors.

Parameters
layers_activation_derivativeForward propagation activation derivative.
homogeneous_solutionHomogeneous solution for calculating the conditioned outputs.
output_objective_gradientGradient of the outputs objective function.

Definition at line 736 of file performance_term.cpp.

Vector< double > OpenNN::PerformanceTerm::calculate_point_gradient ( const Vector< double > &  inputs,
const Vector< Vector< double > > &  layers_activation,
const Vector< Vector< double > > &  layers_delta 
) const

Returns the gradient of the performance term function at some input point.

Parameters
inputsInput vector.
layers_activationActivations of all layers in the multilayer perceptron
layers_deltaVector of vectors containing the partial derivatives of the outputs objective function with respect to all the combinations of all layers.

Definition at line 830 of file performance_term.cpp.

Vector< double > OpenNN::PerformanceTerm::calculate_point_gradient ( const Vector< Matrix< double > > &  layers_combination_parameters_Jacobian,
const Vector< Vector< double > > &  layers_delta 
) const

Returns the gradient of the performance term function at some input point.

Parameters
layers_combination_parameters_Jacobian
layers_delta

Definition at line 987 of file performance_term.cpp.

Matrix< double > OpenNN::PerformanceTerm::calculate_point_Hessian ( const Vector< Vector< double > > &  layers_activation_derivative,
const Vector< Vector< Vector< double > > > &  perceptrons_combination_parameters_gradient,
const Matrix< Matrix< double > > &  interlayers_combination_combination_Jacobian,
const Vector< Vector< double > > &  layers_delta,
const Matrix< Matrix< double > > &  interlayers_Delta 
) const

Returns the Hessian of the performance term at some input.

Parameters
layers_activation_derivative
perceptrons_combination_parameters_gradient
interlayers_combination_combination_Jacobian
layers_delta
interlayers_Delta
Todo:

Definition at line 1217 of file performance_term.cpp.

void OpenNN::PerformanceTerm::check ( void  ) const
virtual

Checks that there is a neural network associated to the performance term. If some of the above conditions is not hold, the method throws an exception.

Reimplemented in OpenNN::SolutionsError, OpenNN::FinalSolutionsError, OpenNN::IndependentParametersError, OpenNN::InverseSumSquaredError, OpenNN::MeanSquaredError, OpenNN::MinkowskiError, OpenNN::CrossEntropyError, OpenNN::NormalizedSquaredError, OpenNN::OutputsIntegrals, OpenNN::SumSquaredError, OpenNN::RootMeanSquaredError, and OpenNN::NeuralParametersNorm.

Definition at line 611 of file performance_term.cpp.

void OpenNN::PerformanceTerm::from_XML ( const tinyxml2::XMLDocument &  document)
virtual
const bool & OpenNN::PerformanceTerm::get_display ( void  ) const

Returns true if messages from this class can be displayed on the screen, or false if messages from this class can't be displayed on the screen.

Definition at line 288 of file performance_term.cpp.

bool OpenNN::PerformanceTerm::has_data_set ( void  ) const

Returns true if this performance term has a data set associated, and false otherwise.

Definition at line 335 of file performance_term.cpp.

bool OpenNN::PerformanceTerm::has_mathematical_model ( void  ) const

Returns true if this performance term has a mathematical model associated, and false otherwise.

Definition at line 317 of file performance_term.cpp.

bool OpenNN::PerformanceTerm::has_neural_network ( void  ) const

Returns true if this performance term has a neural network associated, and false otherwise.

Definition at line 299 of file performance_term.cpp.

bool OpenNN::PerformanceTerm::has_numerical_differentiation ( void  ) const

Returns true if this performance term object contains a numerical differentiation object, and false otherwise.

Definition at line 353 of file performance_term.cpp.

PerformanceTerm & OpenNN::PerformanceTerm::operator= ( const PerformanceTerm other_performance_term)
virtual

Assignment operator. It assigns to this performance term object the members from another performance term object.

Parameters
other_performance_termPerformance term object to be copied.

Definition at line 213 of file performance_term.cpp.

bool OpenNN::PerformanceTerm::operator== ( const PerformanceTerm other_performance_term) const
virtual

Equal to operator. It compares this object to another object. The return is true if both objects have the same member data, and false otherwise.

Definition at line 249 of file performance_term.cpp.

void OpenNN::PerformanceTerm::set ( void  )
virtual

Sets all the member pointers to NULL (neural network, data set, mathematical model and numerical differentiation). It also initializes all the rest of class members to their default values.

Reimplemented in OpenNN::FinalSolutionsError.

Definition at line 371 of file performance_term.cpp.

void OpenNN::PerformanceTerm::set ( NeuralNetwork new_neural_network_pointer)
virtual

Sets all the member pointers to NULL, but the neural network, which set to a given pointer. It also initializes all the rest of class members to their default values.

Parameters
new_neural_network_pointerPointer to a neural network object.

Reimplemented in OpenNN::FinalSolutionsError.

Definition at line 388 of file performance_term.cpp.

void OpenNN::PerformanceTerm::set ( DataSet new_data_set_pointer)
virtual

Sets all the member pointers to NULL, but the data set, which set to a given pointer. It also initializes all the rest of class members to their default values.

Parameters
new_data_set_pointerPointer to a data set object.

Definition at line 405 of file performance_term.cpp.

void OpenNN::PerformanceTerm::set ( MathematicalModel new_mathematical_model_pointer)
virtual

Sets all the member pointers to NULL, but the mathematical model, which set to a given pointer. It also initializes all the rest of class members to their default values.

Parameters
new_mathematical_model_pointerPointer to a mathematical model object.

Reimplemented in OpenNN::FinalSolutionsError.

Definition at line 422 of file performance_term.cpp.

void OpenNN::PerformanceTerm::set ( NeuralNetwork new_neural_network_pointer,
DataSet new_data_set_pointer 
)
virtual

Sets new neural network and data set pointers. It also sets the mathematical model and numerical differentiation pointers to NULL. Finally, it 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 441 of file performance_term.cpp.

void OpenNN::PerformanceTerm::set ( NeuralNetwork new_neural_network_pointer,
MathematicalModel new_mathematical_model_pointer 
)
virtual

Sets new neural network and mathematical model pointers. It also sets the data set and numerical differentiation pointers to NULL. Finally, it initializes all the rest of class members to their default values.

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

Reimplemented in OpenNN::FinalSolutionsError.

Definition at line 460 of file performance_term.cpp.

void OpenNN::PerformanceTerm::set ( NeuralNetwork new_neural_network_pointer,
MathematicalModel new_mathematical_model_pointer,
DataSet new_data_set_pointer 
)
virtual

Sets new neural network, mathematical model and data set pointers. The numerical differentiation pointer is set to NULL. It also initializes all the rest of class members to their default values.

Parameters
new_neural_network_pointerPointer to a neural network object.
new_mathematical_model_pointerPointer to mathematical model object.
new_data_set_pointerPointer to a data set object.

Definition at line 480 of file performance_term.cpp.

void OpenNN::PerformanceTerm::set ( const PerformanceTerm other_performance_term)

Sets to this performance term object the members of another performance term object.

Parameters
other_performance_termPerformance term to be copied.

Definition at line 496 of file performance_term.cpp.

void OpenNN::PerformanceTerm::set_default ( void  )
virtual

Sets the members of the performance term to their default values:

  • Display: true.

Reimplemented in OpenNN::SolutionsError, OpenNN::FinalSolutionsError, OpenNN::IndependentParametersError, OpenNN::InverseSumSquaredError, OpenNN::OutputsIntegrals, OpenNN::MinkowskiError, and OpenNN::NeuralParametersNorm.

Definition at line 562 of file performance_term.cpp.

void OpenNN::PerformanceTerm::set_display ( const bool &  new_display)

Sets a new display value. If it is set to true messages from this class are to be displayed on the screen; if it is set to false messages from this class are not to be displayed on the screen.

Parameters
new_displayDisplay value.

Definition at line 575 of file performance_term.cpp.

void OpenNN::PerformanceTerm::set_neural_network_pointer ( NeuralNetwork new_neural_network_pointer)
virtual

Sets a pointer to a neural network object which is to be associated to the performance term.

Parameters
new_neural_network_pointerPointer to a neural network object to be associated to the performance term.

Definition at line 518 of file performance_term.cpp.

void OpenNN::PerformanceTerm::set_numerical_differentiation_pointer ( NumericalDifferentiation new_numerical_differentiation_pointer)

Sets a new numerical differentiation pointer in this performance term object.

Parameters
new_numerical_differentiation_pointerPointer to a numerical differentiation object.

Definition at line 549 of file performance_term.cpp.

tinyxml2::XMLDocument * OpenNN::PerformanceTerm::to_XML ( void  ) const
virtual

Serializes a default performance term object into a XML document of the TinyXML library. See the OpenNN manual for more information about the format of this document.

Reimplemented in OpenNN::SolutionsError, OpenNN::FinalSolutionsError, OpenNN::SumSquaredError, OpenNN::NormalizedSquaredError, OpenNN::MeanSquaredError, OpenNN::IndependentParametersError, OpenNN::CrossEntropyError, OpenNN::MinkowskiError, OpenNN::InverseSumSquaredError, OpenNN::OutputsIntegrals, OpenNN::NeuralParametersNorm, and OpenNN::RootMeanSquaredError.

Definition at line 1552 of file performance_term.cpp.

std::string OpenNN::PerformanceTerm::write_information ( void  ) const
virtual

Returns a string with the default information of the performance term. It will be used by the training strategy to monitor the training process. By default this information is empty.

Reimplemented in OpenNN::SolutionsError, OpenNN::FinalSolutionsError, OpenNN::NormalizedSquaredError, OpenNN::IndependentParametersError, and OpenNN::NeuralParametersNorm.

Definition at line 1526 of file performance_term.cpp.


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