OpenNN
2.2
Open Neural Networks Library
|
#include <performance_term.h>
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 PerformanceTerm & | operator= (const PerformanceTerm &) |
virtual bool | operator== (const PerformanceTerm &) const |
NeuralNetwork * | get_neural_network_pointer (void) const |
MathematicalModel * | get_mathemtaical_model_pointer (void) const |
DataSet * | get_data_set_pointer (void) const |
NumericalDifferentiation * | get_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 | |
NeuralNetwork * | neural_network_pointer |
DataSet * | data_set_pointer |
MathematicalModel * | mathematical_model_pointer |
NumericalDifferentiation * | numerical_differentiation_pointer |
bool | display |
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.
|
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.
|
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.
new_neural_network_pointer | Pointer to a neural network object. |
Definition at line 45 of file performance_term.cpp.
|
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.
new_data_set_pointer | Pointer to a data set object. |
Definition at line 63 of file performance_term.cpp.
|
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.
new_mathematical_model_pointer | Pointer to a mathematical model object. |
Definition at line 81 of file performance_term.cpp.
|
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.
new_neural_network_pointer | Pointer to a neural network object. |
new_data_set_pointer | Pointer to a data set object. |
Definition at line 100 of file performance_term.cpp.
|
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.
new_neural_network_pointer | Pointer to a neural network object. |
new_mathematical_model_pointer | Pointer to a mathematical model object. |
Definition at line 119 of file performance_term.cpp.
|
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.
new_neural_network_pointer | Pointer to a neural network object. |
new_mathematical_model_pointer | Pointer to a mathematical model object. |
new_data_set_pointer | Pointer to a data set object. |
Definition at line 139 of file performance_term.cpp.
|
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.
performance_term_document | Pointer 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.
other_performance_term | Performance term object to be copied. |
Definition at line 174 of file performance_term.cpp.
|
virtual |
Destructor. It deletes the numerical differentiation object composing this performance term object.
Definition at line 199 of file performance_term.cpp.
|
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.
|
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.
|
virtual |
Returns the performance term Hessian.
Reimplemented in OpenNN::IndependentParametersError, OpenNN::CrossEntropyError, OpenNN::MeanSquaredError, OpenNN::MinkowskiError, OpenNN::OutputsIntegrals, OpenNN::SumSquaredError, OpenNN::NormalizedSquaredError, OpenNN::RootMeanSquaredError, and OpenNN::NeuralParametersNorm.
Definition at line 1412 of file performance_term.cpp.
|
virtual |
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.
layers_activation_derivative | Activation derivatives of all layers in the multilayer perceptron |
layers_activation_second_derivative | Activation second derivatives of all layers in the multilayer perceptron |
interlayers_combination_combination_Jacobian_form | Matrix of matrices containing the partial derivatives of all layers combinations with respect to all layers combinations. |
output_objective_gradient | Gradient vector of the outputs objective function. |
output_objective_Hessian | Hessian matrix of the outputs objective function. |
layers_delta | Vector of vectors containing the partial derivatives of the outputs objective function with respect to the combinations of all layers. |
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.
a | First integer. |
b | Second 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.
layers_activation_derivative | Forward propagation activation derivative. |
output_objective_gradient | Gradient 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.
layers_activation_derivative | Forward propagation activation derivative. |
homogeneous_solution | Homogeneous solution for calculating the conditioned outputs. |
output_objective_gradient | Gradient 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.
inputs | Input vector. |
layers_activation | Activations of all layers in the multilayer perceptron |
layers_delta | Vector 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.
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.
layers_activation_derivative | |
perceptrons_combination_parameters_gradient | |
interlayers_combination_combination_Jacobian | |
layers_delta | |
interlayers_Delta |
Definition at line 1217 of file performance_term.cpp.
|
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.
|
virtual |
Loads a default performance term from a XML document.
document | TinyXML document containing the performance term members. |
Reimplemented in OpenNN::SolutionsError, OpenNN::FinalSolutionsError, OpenNN::SumSquaredError, OpenNN::NormalizedSquaredError, OpenNN::IndependentParametersError, OpenNN::CrossEntropyError, OpenNN::MinkowskiError, OpenNN::OutputsIntegrals, OpenNN::InverseSumSquaredError, OpenNN::NeuralParametersNorm, and OpenNN::RootMeanSquaredError.
Definition at line 1573 of file performance_term.cpp.
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.
|
virtual |
Assignment operator. It assigns to this performance term object the members from another performance term object.
other_performance_term | Performance term object to be copied. |
Definition at line 213 of file performance_term.cpp.
|
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.
|
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.
|
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.
new_neural_network_pointer | Pointer to a neural network object. |
Reimplemented in OpenNN::FinalSolutionsError.
Definition at line 388 of file performance_term.cpp.
|
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.
new_data_set_pointer | Pointer to a data set object. |
Definition at line 405 of file performance_term.cpp.
|
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.
new_mathematical_model_pointer | Pointer to a mathematical model object. |
Reimplemented in OpenNN::FinalSolutionsError.
Definition at line 422 of file performance_term.cpp.
|
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.
new_neural_network_pointer | Pointer to a neural network object. |
new_data_set_pointer | Pointer to a data set object. |
Definition at line 441 of file performance_term.cpp.
|
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.
new_neural_network_pointer | Pointer to a neural network object. |
new_mathematical_model_pointer | Pointer to a data set object. |
Reimplemented in OpenNN::FinalSolutionsError.
Definition at line 460 of file performance_term.cpp.
|
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.
new_neural_network_pointer | Pointer to a neural network object. |
new_mathematical_model_pointer | Pointer to mathematical model object. |
new_data_set_pointer | Pointer 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.
other_performance_term | Performance term to be copied. |
Definition at line 496 of file performance_term.cpp.
|
virtual |
Sets the members of the performance term to their default values:
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.
new_display | Display value. |
Definition at line 575 of file performance_term.cpp.
|
virtual |
Sets a pointer to a neural network object which is to be associated to the performance term.
new_neural_network_pointer | Pointer 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.
new_numerical_differentiation_pointer | Pointer to a numerical differentiation object. |
Definition at line 549 of file performance_term.cpp.
|
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.
|
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.