OpenNN
2.2
Open Neural Networks Library
|
#include <levenberg_marquardt_algorithm.h>
Classes | |
struct | LevenbergMarquardtAlgorithmResults |
Private Attributes | |
double | damping_parameter |
double | minimum_damping_parameter |
double | maximum_damping_parameter |
double | damping_parameter_factor |
bool | reserve_damping_parameter_history |
Vector< double > | damping_parameter_history |
double | warning_parameters_norm |
double | warning_gradient_norm |
double | error_parameters_norm |
double | error_gradient_norm |
double | minimum_parameters_increment_norm |
double | minimum_performance_increase |
double | performance_goal |
double | gradient_norm_goal |
size_t | maximum_generalization_performance_decreases |
size_t | maximum_iterations_number |
double | maximum_time |
bool | reserve_parameters_history |
bool | reserve_parameters_norm_history |
bool | reserve_performance_history |
bool | reserve_gradient_history |
bool | reserve_gradient_norm_history |
bool | reserve_Hessian_approximation_history |
bool | reserve_elapsed_time_history |
bool | reserve_generalization_performance_history |
Additional Inherited Members | |
Protected Attributes inherited from OpenNN::TrainingAlgorithm | |
PerformanceFunctional * | performance_functional_pointer |
size_t | display_period |
size_t | save_period |
std::string | neural_network_file_name |
bool | display |
This concrete class represents a Levenberg-Marquardt Algorithm training algorithm for the sum squared error performance functional for a multilayer perceptron.
Definition at line 43 of file levenberg_marquardt_algorithm.h.
|
explicit |
Default constructor. It creates a Levenberg-Marquardt training algorithm object not associated to any performance functional object. It also initializes the class members to their default values.
Definition at line 27 of file levenberg_marquardt_algorithm.cpp.
|
explicit |
Performance functional constructor. It creates a Levenberg-Marquardt training algorithm object associated associated with a given performance functional object. It also initializes the class members to their default values.
new_performance_functional_pointer | Pointer to an external performance functional object. |
Definition at line 41 of file levenberg_marquardt_algorithm.cpp.
|
explicit |
XML Constructor. Creates a Levenberg-Marquardt algorithm object, and loads its members from a XML document.
document | TinyXML document containing the Levenberg-Marquardt algorithm data. |
Definition at line 66 of file levenberg_marquardt_algorithm.cpp.
|
virtual |
Destructor. This destructor does not delete any object.
Definition at line 80 of file levenberg_marquardt_algorithm.cpp.
Vector< double > OpenNN::LevenbergMarquardtAlgorithm::calculate_gradient | ( | const Vector< double > & | terms, |
const Matrix< double > & | terms_Jacobian | ||
) | const |
Returns the exact gradient vector of the performance function as a function of the terms vector and the terms Jacobian matrix.
terms | Vector with the performance terms values. |
terms_Jacobian | Jacobian matrix of the performance terms function. |
Definition at line 993 of file levenberg_marquardt_algorithm.cpp.
Matrix< double > OpenNN::LevenbergMarquardtAlgorithm::calculate_Hessian_approximation | ( | const Matrix< double > & | terms_Jacobian | ) | const |
Returns an approximation of the Hessian matrix of the performance function as a function of the performance terms Jacobian.
terms_Jacobian | Jacobian matrix of the terms function. |
Definition at line 1028 of file levenberg_marquardt_algorithm.cpp.
double OpenNN::LevenbergMarquardtAlgorithm::calculate_performance | ( | const Vector< double > & | terms | ) | const |
Evaluates the performance function from the evaluation of the terms function.
terms | Vector of performance terms. |
Definition at line 980 of file levenberg_marquardt_algorithm.cpp.
|
virtual |
Checks that the Levenberg-Marquard object is ok for training. In particular, it checks that:
If that checkings are not hold, an exception is thrown.
Reimplemented from OpenNN::TrainingAlgorithm.
Definition at line 937 of file levenberg_marquardt_algorithm.cpp.
|
virtual |
Loads a Levenberg-Marquardt method object from a XML document. Please mind about the format, wich is specified in the OpenNN manual.
document | TinyXML document containint the object data. |
Reimplemented from OpenNN::TrainingAlgorithm.
Definition at line 2164 of file levenberg_marquardt_algorithm.cpp.
const double & OpenNN::LevenbergMarquardtAlgorithm::get_error_gradient_norm | ( | void | ) | const |
Returns the value for the norm of the gradient vector at wich an error message is written to the screen and the program exits.
Definition at line 123 of file levenberg_marquardt_algorithm.cpp.
const double & OpenNN::LevenbergMarquardtAlgorithm::get_error_parameters_norm | ( | void | ) | const |
Returns the value for the norm of the parameters vector at wich an error message is written to the screen and the program exits.
Definition at line 112 of file levenberg_marquardt_algorithm.cpp.
const double & OpenNN::LevenbergMarquardtAlgorithm::get_gradient_norm_goal | ( | void | ) | const |
Returns the goal value for the norm of the performance function gradient. This is used as a stopping criterion when training a neural network.
Definition at line 165 of file levenberg_marquardt_algorithm.cpp.
const double & OpenNN::LevenbergMarquardtAlgorithm::get_performance_goal | ( | void | ) | const |
Returns the goal value for the performance. This is used as a stopping criterion when training a neural network.
Definition at line 154 of file levenberg_marquardt_algorithm.cpp.
const bool & OpenNN::LevenbergMarquardtAlgorithm::get_reserve_Hessian_approximation_history | ( | void | ) | const |
Returns true if the history of the Hessian approximations is to be reserved, and false otherwise.
Definition at line 256 of file levenberg_marquardt_algorithm.cpp.
const double & OpenNN::LevenbergMarquardtAlgorithm::get_warning_gradient_norm | ( | void | ) | const |
Returns the minimum value for the norm of the gradient vector at wich a warning message is written to the screen.
Definition at line 101 of file levenberg_marquardt_algorithm.cpp.
const double & OpenNN::LevenbergMarquardtAlgorithm::get_warning_parameters_norm | ( | void | ) | const |
Returns the minimum value for the norm of the parameters vector at wich a warning message is written to the screen.
Definition at line 90 of file levenberg_marquardt_algorithm.cpp.
|
virtual |
Trains a neural network with an associated performance functional according to the Levenberg-Marquardt algorithm. Training occurs according to the training parameters.
Implements OpenNN::TrainingAlgorithm.
Definition at line 1306 of file levenberg_marquardt_algorithm.cpp.
void OpenNN::LevenbergMarquardtAlgorithm::set_damping_parameter | ( | const double & | new_damping_parameter | ) |
Sets a new damping parameter (lambda in the User's Guide) for the Hessian approximation.
new_damping_parameter | Damping parameter value. |
Definition at line 420 of file levenberg_marquardt_algorithm.cpp.
void OpenNN::LevenbergMarquardtAlgorithm::set_damping_parameter_factor | ( | const double & | new_damping_parameter_factor | ) |
Sets a new damping parameter factor (beta in the User's Guide) for the Hessian approximation.
new_damping_parameter_factor | Damping parameter factor value. |
Definition at line 442 of file levenberg_marquardt_algorithm.cpp.
|
virtual |
Sets the following default values for the Levenberg-Marquardt algorithm: Training parameters:
Stopping criteria:
User stuff:
Reimplemented from OpenNN::TrainingAlgorithm.
Definition at line 361 of file levenberg_marquardt_algorithm.cpp.
void OpenNN::LevenbergMarquardtAlgorithm::set_display_period | ( | const size_t & | new_display_period | ) |
Sets a new number of iterations between the training showing progress.
new_display_period | Number of iterations between the training showing progress. |
Definition at line 903 of file levenberg_marquardt_algorithm.cpp.
void OpenNN::LevenbergMarquardtAlgorithm::set_error_gradient_norm | ( | const double & | new_error_gradient_norm | ) |
Sets a new value for the gradient vector norm at which an error message is written to the screen and the program exits.
new_error_gradient_norm | Error norm of gradient vector value. |
Definition at line 625 of file levenberg_marquardt_algorithm.cpp.
void OpenNN::LevenbergMarquardtAlgorithm::set_error_parameters_norm | ( | const double & | new_error_parameters_norm | ) |
Sets a new value for the parameters vector norm at which an error message is written to the screen and the program exits.
new_error_parameters_norm | Error norm of parameters vector value. |
Definition at line 594 of file levenberg_marquardt_algorithm.cpp.
void OpenNN::LevenbergMarquardtAlgorithm::set_gradient_norm_goal | ( | const double & | new_gradient_norm_goal | ) |
Sets a new the goal value for the norm of the performance function gradient. This is used as a stopping criterion when training a neural network.
new_gradient_norm_goal | Goal value for the norm of the performance function gradient. |
Definition at line 728 of file levenberg_marquardt_algorithm.cpp.
void OpenNN::LevenbergMarquardtAlgorithm::set_maximum_damping_parameter | ( | const double & | new_maximum_damping_parameter | ) |
Sets a new maximum damping parameter allowed in the algorithm.
new_maximum_damping_parameter | Maximum damping parameter value. |
Definition at line 494 of file levenberg_marquardt_algorithm.cpp.
void OpenNN::LevenbergMarquardtAlgorithm::set_maximum_generalization_performance_decreases | ( | const size_t & | new_maximum_generalization_performance_decreases | ) |
Sets a new maximum number of generalization failures.
new_maximum_generalization_performance_decreases | Maximum number of iterations in which the generalization evalutation decreases. |
Definition at line 758 of file levenberg_marquardt_algorithm.cpp.
void OpenNN::LevenbergMarquardtAlgorithm::set_maximum_iterations_number | ( | const size_t & | new_maximum_iterations_number | ) |
Sets a maximum number of iterations for training.
new_maximum_iterations_number | Maximum number of iterations for training. |
Definition at line 769 of file levenberg_marquardt_algorithm.cpp.
void OpenNN::LevenbergMarquardtAlgorithm::set_maximum_time | ( | const double & | new_maximum_time | ) |
Sets a new maximum training time.
new_maximum_time | Maximum training time. |
Definition at line 780 of file levenberg_marquardt_algorithm.cpp.
void OpenNN::LevenbergMarquardtAlgorithm::set_minimum_damping_parameter | ( | const double & | new_minimum_damping_parameter | ) |
Sets a new minimum damping parameter allowed in the algorithm.
new_minimum_damping_parameter | Minimum damping parameter value. |
Definition at line 468 of file levenberg_marquardt_algorithm.cpp.
void OpenNN::LevenbergMarquardtAlgorithm::set_minimum_parameters_increment_norm | ( | const double & | new_minimum_parameters_increment_norm | ) |
Sets a new value for the minimum parameters increment norm stopping criterion.
new_minimum_parameters_increment_norm | Value of norm of parameters increment norm used to stop training. |
Definition at line 655 of file levenberg_marquardt_algorithm.cpp.
void OpenNN::LevenbergMarquardtAlgorithm::set_minimum_performance_increase | ( | const double & | new_minimum_performance_increase | ) |
Sets a new minimum performance improvement during training.
new_minimum_performance_increase | Minimum improvement in the performance between two iterations. |
Definition at line 685 of file levenberg_marquardt_algorithm.cpp.
void OpenNN::LevenbergMarquardtAlgorithm::set_performance_goal | ( | const double & | new_performance_goal | ) |
Sets a new goal value for the performance. This is used as a stopping criterion when training a neural network.
new_performance_goal | Goal value for the performance. |
Definition at line 716 of file levenberg_marquardt_algorithm.cpp.
void OpenNN::LevenbergMarquardtAlgorithm::set_reserve_damping_parameter_history | ( | const bool & | new_reserve_damping_parameter_history | ) |
Makes the damping parameter history vector to be reseved or not in memory.
new_reserve_damping_parameter_history | True if the damping parameter history vector is to be reserved, false otherwise. |
Definition at line 520 of file levenberg_marquardt_algorithm.cpp.
void OpenNN::LevenbergMarquardtAlgorithm::set_reserve_elapsed_time_history | ( | const bool & | new_reserve_elapsed_time_history | ) |
Makes the elapsed time over the iterations to be reseved or not in memory. This is a vector.
new_reserve_elapsed_time_history | True if the elapsed time history vector is to be reserved, false otherwise. |
Definition at line 879 of file levenberg_marquardt_algorithm.cpp.
void OpenNN::LevenbergMarquardtAlgorithm::set_reserve_generalization_performance_history | ( | const bool & | new_reserve_generalization_performance_history | ) |
Makes the Generalization performance history to be reserved or not in memory. This is a vector.
new_reserve_generalization_performance_history | True if the Generalization performance history is to be reserved, false otherwise. |
Definition at line 891 of file levenberg_marquardt_algorithm.cpp.
void OpenNN::LevenbergMarquardtAlgorithm::set_reserve_gradient_history | ( | const bool & | new_reserve_gradient_history | ) |
Makes the gradient history vector of vectors to be reseved or not in memory.
new_reserve_gradient_history | True if the gradient history matrix is to be reserved, false otherwise. |
Definition at line 843 of file levenberg_marquardt_algorithm.cpp.
void OpenNN::LevenbergMarquardtAlgorithm::set_reserve_gradient_norm_history | ( | const bool & | new_reserve_gradient_norm_history | ) |
Makes the gradient norm history vector to be reseved or not in memory.
new_reserve_gradient_norm_history | True if the gradient norm history matrix is to be reserved, false otherwise. |
Definition at line 855 of file levenberg_marquardt_algorithm.cpp.
void OpenNN::LevenbergMarquardtAlgorithm::set_reserve_Hessian_approximation_history | ( | const bool & | new_reserve_Hessian_approximation_history | ) |
Sets the history of the Hessian approximation to be reserved or not in memory. This is a vector of matrices.
new_reserve_Hessian_approximation_history | True if the Hessian approximation history is to be reserved, false otherwise. |
Definition at line 867 of file levenberg_marquardt_algorithm.cpp.
void OpenNN::LevenbergMarquardtAlgorithm::set_reserve_parameters_history | ( | const bool & | new_reserve_parameters_history | ) |
Makes the parameters history vector of vectors to be reseved or not in memory.
new_reserve_parameters_history | True if the parameters history vector of vectors is to be reserved, false otherwise. |
Definition at line 810 of file levenberg_marquardt_algorithm.cpp.
void OpenNN::LevenbergMarquardtAlgorithm::set_reserve_parameters_norm_history | ( | const bool & | new_reserve_parameters_norm_history | ) |
Makes the parameters norm history vector to be reseved or not in memory.
new_reserve_parameters_norm_history | True if the parameters norm history vector is to be reserved, false otherwise. |
Definition at line 821 of file levenberg_marquardt_algorithm.cpp.
void OpenNN::LevenbergMarquardtAlgorithm::set_reserve_performance_history | ( | const bool & | new_reserve_performance_history | ) |
Makes the performance history vector to be reseved or not in memory.
new_reserve_performance_history | True if the performance history vector is to be reserved, false otherwise. |
Definition at line 832 of file levenberg_marquardt_algorithm.cpp.
void OpenNN::LevenbergMarquardtAlgorithm::set_warning_gradient_norm | ( | const double & | new_warning_gradient_norm | ) |
Sets a new value for the gradient vector norm at which a warning message is written to the screen.
new_warning_gradient_norm | Warning norm of gradient vector value. |
Definition at line 563 of file levenberg_marquardt_algorithm.cpp.
void OpenNN::LevenbergMarquardtAlgorithm::set_warning_parameters_norm | ( | const double & | new_warning_parameters_norm | ) |
Sets a new value for the parameters vector norm at which a warning message is written to the screen.
new_warning_parameters_norm | Warning norm of parameters vector value. |
Definition at line 532 of file levenberg_marquardt_algorithm.cpp.
|
virtual |
Returns a default (empty) string matrix containing the members of the training algorithm object.
Reimplemented from OpenNN::TrainingAlgorithm.
Definition at line 1688 of file levenberg_marquardt_algorithm.cpp.
|
virtual |
Serializes a default training algorithm object into a XML document of the TinyXML library. See the OpenNN manual for more information about the format of this document.
Reimplemented from OpenNN::TrainingAlgorithm.
Definition at line 1833 of file levenberg_marquardt_algorithm.cpp.
|
private |
Maximum number of iterations at which the generalization performance decreases. This is an early stopping method for improving generalization.
Definition at line 369 of file levenberg_marquardt_algorithm.h.