OpenNN  2.2
Open Neural Networks Library
Public Types | Public Member Functions | Protected Attributes | List of all members
OpenNN::SolutionsError Class Reference

#include <solutions_error.h>

Inheritance diagram for OpenNN::SolutionsError:
OpenNN::PerformanceTerm

Public Types

enum  SolutionsErrorMethod { SolutionsErrorSum, SolutionsErrorIntegral }
 

Public Member Functions

 SolutionsError (void)
 
 SolutionsError (NeuralNetwork *)
 
 SolutionsError (MathematicalModel *)
 
 SolutionsError (NeuralNetwork *, MathematicalModel *)
 
 SolutionsError (const tinyxml2::XMLDocument &)
 
 SolutionsError (const SolutionsError &)
 
SolutionsErroroperator= (const SolutionsError &)
 
bool operator== (const SolutionsError &) const
 
virtual ~SolutionsError (void)
 
const SolutionsErrorMethodget_solutions_error_method (void) const
 
std::string write_solutions_error_method (void) const
 
const Vector< double > & get_solutions_errors_weights (void) const
 
const double & get_solution_error_weight (const size_t &) const
 
void set_solutions_error_method (const SolutionsErrorMethod &)
 
void set_solutions_error_method (const std::string &)
 
void set_solutions_errors_weights (const Vector< double > &)
 
void set_solution_error_weight (const size_t &, const double &)
 
void set_default (void)
 
virtual Matrix< double > calculate_target_dependent_variables (const Matrix< double > &) const
 
void check (void) const
 
double calculate_solutions_error_sum (void) const
 
double calculate_solutions_error_integral (void) const
 
virtual double calculate_performance (void) const
 
virtual double calculate_performance (const Vector< double > &) const
 
std::string write_performance_term_type (void) const
 
std::string write_information (void) const
 
virtual void print (void) const
 
tinyxml2::XMLDocument * to_XML (void) const
 
void from_XML (const tinyxml2::XMLDocument &)
 
- Public Member Functions inherited from OpenNN::PerformanceTerm
 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 *)
 
void set_display (const bool &)
 
void construct_numerical_differentiation (void)
 
void delete_numerical_differentiation_pointer (void)
 
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_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 to_string (void) const
 
size_t calculate_Kronecker_delta (const size_t &, const size_t &) const
 

Protected Attributes

NumericalIntegration numerical_integration
 
SolutionsErrorMethod solutions_error_method
 
Vector< double > solutions_errors_weights
 
- Protected Attributes inherited from OpenNN::PerformanceTerm
NeuralNetworkneural_network_pointer
 
DataSetdata_set_pointer
 
MathematicalModelmathematical_model_pointer
 
NumericalDifferentiationnumerical_differentiation_pointer
 
bool display
 

Detailed Description

This class implements a performance term called solutions error. This performance term is measured on a mathematical model. It computes the difference between the solution from a mathematical model and a given target solution. This type of functional is very used in optimal control problems, in which the neural network represents the control variables. The first and second derivatives of this type of performance term are calculated with numerical differentiation.

Definition at line 45 of file solutions_error.h.

Constructor & Destructor Documentation

OpenNN::SolutionsError::SolutionsError ( void  )
explicit

Default constructor. It creates a solutions error performance term not associated to any neural network and not measured on any mathematical model. It also initializes all the rest of class members to their default values.

Definition at line 28 of file solutions_error.cpp.

OpenNN::SolutionsError::SolutionsError ( NeuralNetwork new_neural_network_pointer)
explicit

Neural network constructor. It creates a solutions error associated to a neural network, but not to a . 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 43 of file solutions_error.cpp.

OpenNN::SolutionsError::SolutionsError ( MathematicalModel new_mathematical_model_pointer)
explicit

Mathematical model constructor. It creates solutions error object not associated to any neural network but to be measured on a given mathematical model object. 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 59 of file solutions_error.cpp.

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

Neural network and mathematical model constructor. It creates a solutions error functional associated to a neural network and measured on a mathematical model. 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 76 of file solutions_error.cpp.

OpenNN::SolutionsError::SolutionsError ( const tinyxml2::XMLDocument &  solutions_error_document)
explicit

xml constructor. It creates a solutions error performance term not associated to any neural network and not measured on any mathematical model. It also initializes all the rest of class members with values taken from a TinyXML document->

Parameters
solutions_error_documentXML document containing the class members.

Definition at line 92 of file solutions_error.cpp.

OpenNN::SolutionsError::SolutionsError ( const SolutionsError other_solutions_error)

Copy constructor. It creates a copy of an existing solutions error object.

Parameters
other_solutions_errorSolutions error object to be copied.

Definition at line 107 of file solutions_error.cpp.

OpenNN::SolutionsError::~SolutionsError ( void  )
virtual

Destructor. This destructor does not delete any object. The numerical differentiation object is deleted by the performance term destructor.

Definition at line 138 of file solutions_error.cpp.

Member Function Documentation

double OpenNN::SolutionsError::calculate_performance ( const Vector< double > &  parameters) const
virtual

Calculates the solutions error value of the neural network for a given set of parameters.

Parameters
parametersVector of potential neural network parameters.

Implements OpenNN::PerformanceTerm.

Definition at line 583 of file solutions_error.cpp.

double OpenNN::SolutionsError::calculate_solutions_error_integral ( void  ) const
Todo:

Definition at line 529 of file solutions_error.cpp.

double OpenNN::SolutionsError::calculate_solutions_error_sum ( void  ) const

Calculates the solutions error performance as the weighted mean squared error between the solutions to the mathematical model and the target solutions.

Definition at line 481 of file solutions_error.cpp.

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

Checks that:

  • The pointer to the neural network is not NULL.
  • The pointer to the multilayer perceptron inside the neural network is not NULL.
  • The pointer to the mathematical method is not NULL.
  • The size of the solutions errors weights is equal to the number of dependent variables.

If some of the conditions above is not hold, an exception is thrown.

Reimplemented from OpenNN::PerformanceTerm.

Definition at line 401 of file solutions_error.cpp.

void OpenNN::SolutionsError::from_XML ( const tinyxml2::XMLDocument &  document)
virtual

Loads a solutions error object from a XML document.

Parameters
documentTinyXML document with the members of the solutions error object.

Reimplemented from OpenNN::PerformanceTerm.

Definition at line 718 of file solutions_error.cpp.

SolutionsError & OpenNN::SolutionsError::operator= ( const SolutionsError other_solutions_error)

Assignment operator. It assigns to this solutions error object the members from another solutions error object.

Parameters
other_solutions_errorSolutions error object to be copied.

Definition at line 151 of file solutions_error.cpp.

bool OpenNN::SolutionsError::operator== ( const SolutionsError other_solutions_error) const

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

Definition at line 176 of file solutions_error.cpp.

void OpenNN::SolutionsError::set_default ( void  )
virtual

Sets the default values for an object of the solutions error class:

  • Solutions error method: Solutions error sum.
  • Solutions error weights: 1 for all dependent variables.
  • Display: True.

Reimplemented from OpenNN::PerformanceTerm.

Definition at line 347 of file solutions_error.cpp.

void OpenNN::SolutionsError::set_solution_error_weight ( const size_t &  i,
const double &  new_solution_error_weight 
)

Sets a new weight for the solution error of a single dependent variable.

Parameters
iIndex of dependent variable.
new_solution_error_weightWeight for the error between the above dependent variable solution and the corresponding target solution.

Definition at line 332 of file solutions_error.cpp.

void OpenNN::SolutionsError::set_solutions_error_method ( const SolutionsErrorMethod new_solutions_error_method)

Sets a new method for calculating the error between the solution of a mathematical model and a target solution.

Parameters
new_solutions_error_methodMethod for evaluating this performance term.

Definition at line 281 of file solutions_error.cpp.

void OpenNN::SolutionsError::set_solutions_error_method ( const std::string &  new_solutions_error_method)

Sets a new solutions error method from a string with that method's name.

Parameters
new_solutions_error_methodString with the name of the method.

Definition at line 292 of file solutions_error.cpp.

void OpenNN::SolutionsError::set_solutions_errors_weights ( const Vector< double > &  new_solutions_errors_weights)

Sets new weights for the solution error of every dependent variable.

Parameters
new_solutions_errors_weightsWeights for the errors between the dependent variable solutions and the corresponding target solutions.

Definition at line 320 of file solutions_error.cpp.

std::string OpenNN::SolutionsError::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 from OpenNN::PerformanceTerm.

Definition at line 618 of file solutions_error.cpp.


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