#include <conjugate_gradient.h>
Definition at line 35 of file conjugate_gradient.h.
Enumeration of the available training operators for obtaining the training direction.
Definition at line 44 of file conjugate_gradient.h.
OpenNN::ConjugateGradient::ConjugateGradient | ( | void | ) | [explicit] |
Default constructor. It creates a conjugate gradient training algorithm object not associated to any performance functional object. It also initializes the class members to their default values.
Definition at line 46 of file conjugate_gradient.cpp.
OpenNN::ConjugateGradient::ConjugateGradient | ( | PerformanceFunctional * | new_performance_functional_pointer | ) | [explicit] |
General constructor. It creates a conjugate gradient training algorithm associated to a performance functional object. It also initializes the rest of class members to their default values.
new_performance_functional_pointer | Pointer to a performance functional object. |
Definition at line 59 of file conjugate_gradient.cpp.
OpenNN::ConjugateGradient::ConjugateGradient | ( | TiXmlElement * | conjugate_gradient_element | ) | [explicit] |
XML constructor. It creates a conjugate gradient training algorithm not associated to any performance functional object. It also loads the class members from a XML element.
conjugate_gradient_element | Tiny XML element with the members of a conjugate gradient object. |
Definition at line 75 of file conjugate_gradient.cpp.
OpenNN::ConjugateGradient::~ConjugateGradient | ( | void | ) | [virtual] |
const TrainingRateAlgorithm & OpenNN::ConjugateGradient::get_training_rate_algorithm | ( | void | ) | const |
This method returns a constant reference to the training rate algorithm object inside the conjugate gradient method object.
Definition at line 99 of file conjugate_gradient.cpp.
TrainingRateAlgorithm * OpenNN::ConjugateGradient::get_training_rate_algorithm_pointer | ( | void | ) |
This method returns a pointer to the training rate algorithm object inside the conjugate gradient method object.
Definition at line 109 of file conjugate_gradient.cpp.
const ConjugateGradient::TrainingDirectionMethod & OpenNN::ConjugateGradient::get_training_direction_method | ( | void | ) | const |
This method returns the conjugate gradient training direction method used for training.
Definition at line 119 of file conjugate_gradient.cpp.
std::string OpenNN::ConjugateGradient::write_training_direction_method | ( | void | ) | const |
This method returns a string with the name of the training direction.
Definition at line 129 of file conjugate_gradient.cpp.
const double & OpenNN::ConjugateGradient::get_warning_parameters_norm | ( | void | ) | const |
This method returns the minimum value for the norm of the parameters vector at wich a warning message is written to the screen.
Definition at line 164 of file conjugate_gradient.cpp.
const double & OpenNN::ConjugateGradient::get_warning_gradient_norm | ( | void | ) | const |
This method returns the minimum value for the norm of the gradient vector at wich a warning message is written to the screen.
Definition at line 174 of file conjugate_gradient.cpp.
const double & OpenNN::ConjugateGradient::get_warning_training_rate | ( | void | ) | const |
This method returns the training rate value at wich a warning message is written to the screen during line minimization.
Definition at line 184 of file conjugate_gradient.cpp.
const double & OpenNN::ConjugateGradient::get_error_parameters_norm | ( | void | ) | const |
This method 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 194 of file conjugate_gradient.cpp.
const double & OpenNN::ConjugateGradient::get_error_gradient_norm | ( | void | ) | const |
This method 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 205 of file conjugate_gradient.cpp.
const double & OpenNN::ConjugateGradient::get_error_training_rate | ( | void | ) | const |
This method returns the training rate value at wich the line minimization algorithm is assumed to fail when bracketing a minimum.
Definition at line 216 of file conjugate_gradient.cpp.
const double & OpenNN::ConjugateGradient::get_minimum_parameters_increment_norm | ( | void | ) | const |
This method returns the minimum norm of the parameter increment vector used as a stopping criteria when training.
Definition at line 226 of file conjugate_gradient.cpp.
const double & OpenNN::ConjugateGradient::get_minimum_performance_increase | ( | void | ) | const |
This method returns the minimum performance improvement during training.
Definition at line 236 of file conjugate_gradient.cpp.
const double & OpenNN::ConjugateGradient::get_performance_goal | ( | void | ) | const |
This method returns the goal value for the performance. This is used as a stopping criterium when training a multilayer perceptron
Definition at line 247 of file conjugate_gradient.cpp.
const unsigned int & OpenNN::ConjugateGradient::get_maximum_generalization_evaluation_decreases | ( | void | ) | const |
This method returns the maximum number of generalization failures during the training process.
Definition at line 268 of file conjugate_gradient.cpp.
const double & OpenNN::ConjugateGradient::get_gradient_norm_goal | ( | void | ) | const |
This method returns the goal value for the norm of the objective function gradient. This is used as a stopping criterium when training a multilayer perceptron
Definition at line 258 of file conjugate_gradient.cpp.
const unsigned int & OpenNN::ConjugateGradient::get_maximum_epochs_number | ( | void | ) | const |
This method returns the maximum number of epochs for training.
Definition at line 278 of file conjugate_gradient.cpp.
const double & OpenNN::ConjugateGradient::get_maximum_time | ( | void | ) | const |
This method returns the maximum training time.
Definition at line 288 of file conjugate_gradient.cpp.
const bool & OpenNN::ConjugateGradient::get_reserve_parameters_history | ( | void | ) | const |
This method returns true if the parameters history matrix is to be reserved, and false otherwise.
Definition at line 298 of file conjugate_gradient.cpp.
const bool & OpenNN::ConjugateGradient::get_reserve_parameters_norm_history | ( | void | ) | const |
This method returns true if the parameters norm history vector is to be reserved, and false otherwise.
Definition at line 308 of file conjugate_gradient.cpp.
const bool & OpenNN::ConjugateGradient::get_reserve_evaluation_history | ( | void | ) | const |
This method returns true if the evaluation history vector is to be reserved, and false otherwise.
Definition at line 318 of file conjugate_gradient.cpp.
const bool & OpenNN::ConjugateGradient::get_reserve_generalization_evaluation_history | ( | void | ) | const |
This method returns true if the Generalization evaluation history vector is to be reserved, and false otherwise.
Definition at line 379 of file conjugate_gradient.cpp.
const bool & OpenNN::ConjugateGradient::get_reserve_gradient_history | ( | void | ) | const |
This method returns true if the gradient history vector of vectors is to be reserved, and false otherwise.
Definition at line 328 of file conjugate_gradient.cpp.
const bool & OpenNN::ConjugateGradient::get_reserve_gradient_norm_history | ( | void | ) | const |
This method returns true if the gradient norm history vector is to be reserved, and false otherwise.
Definition at line 338 of file conjugate_gradient.cpp.
const bool & OpenNN::ConjugateGradient::get_reserve_training_direction_history | ( | void | ) | const |
This method returns true if the training direction history matrix is to be reserved, and false otherwise.
Definition at line 349 of file conjugate_gradient.cpp.
const bool & OpenNN::ConjugateGradient::get_reserve_training_rate_history | ( | void | ) | const |
This method returns true if the training rate history vector is to be reserved, and false otherwise.
Definition at line 359 of file conjugate_gradient.cpp.
const bool & OpenNN::ConjugateGradient::get_reserve_elapsed_time_history | ( | void | ) | const |
This method returns true if the elapsed time history vector is to be reserved, and false otherwise.
Definition at line 369 of file conjugate_gradient.cpp.
const unsigned int & OpenNN::ConjugateGradient::get_display_period | ( | void | ) | const |
This method returns the number of epochs between the training showing progress.
Definition at line 389 of file conjugate_gradient.cpp.
void OpenNN::ConjugateGradient::set_default | ( | void | ) | [virtual] |
This method sets the default values into a conjugate gradient object. Training operators:
Reimplemented from OpenNN::TrainingAlgorithm.
Definition at line 520 of file conjugate_gradient.cpp.
void OpenNN::ConjugateGradient::set_training_direction_method | ( | const TrainingDirectionMethod & | new_training_direction_method | ) |
This method sets a new training direction method to be used for training.
new_training_direction_method | Conjugate gradient training direction method. |
Definition at line 403 of file conjugate_gradient.cpp.
void OpenNN::ConjugateGradient::set_training_direction_method | ( | const std::string & | new_training_direction_method_name | ) |
This method sets a new conjugate gradient training direction from a string representation. Possible values are:
new_training_direction_method_name | String with the name of the training direction method. |
Definition at line 419 of file conjugate_gradient.cpp.
void OpenNN::ConjugateGradient::set_warning_parameters_norm | ( | const double & | new_warning_parameters_norm | ) |
This method 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 574 of file conjugate_gradient.cpp.
void OpenNN::ConjugateGradient::set_warning_gradient_norm | ( | const double & | new_warning_gradient_norm | ) |
This method 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 605 of file conjugate_gradient.cpp.
void OpenNN::ConjugateGradient::set_warning_training_rate | ( | const double & | new_warning_training_rate | ) |
This method sets a new training rate value at wich a warning message is written to the screen during line minimization.
new_warning_training_rate | Warning training rate value. |
Definition at line 636 of file conjugate_gradient.cpp.
void OpenNN::ConjugateGradient::set_error_parameters_norm | ( | const double & | new_error_parameters_norm | ) |
This method 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 665 of file conjugate_gradient.cpp.
void OpenNN::ConjugateGradient::set_error_gradient_norm | ( | const double & | new_error_gradient_norm | ) |
This method 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 696 of file conjugate_gradient.cpp.
void OpenNN::ConjugateGradient::set_error_training_rate | ( | const double & | new_error_training_rate | ) |
This method sets a new training rate value at wich a the line minimization algorithm is assumed to fail when bracketing a minimum.
new_error_training_rate | Error training rate value. |
Definition at line 727 of file conjugate_gradient.cpp.
void OpenNN::ConjugateGradient::set_minimum_parameters_increment_norm | ( | const double & | new_minimum_parameters_increment_norm | ) |
This method sets a new value for the minimum parameters increment norm stopping criterium.
new_minimum_parameters_increment_norm | Value of norm of parameters increment norm used to stop training. |
Definition at line 757 of file conjugate_gradient.cpp.
void OpenNN::ConjugateGradient::set_performance_goal | ( | const double & | new_performance_goal | ) |
This method sets a new goal value for the performance. This is used as a stopping criterium when training a multilayer perceptron
new_performance_goal | Goal value for the performance. |
Definition at line 818 of file conjugate_gradient.cpp.
void OpenNN::ConjugateGradient::set_minimum_performance_increase | ( | const double & | new_minimum_performance_increase | ) |
This method sets a new minimum performance improvement during training.
new_minimum_performance_increase | Minimum improvement in the performance between two epochs. |
Definition at line 787 of file conjugate_gradient.cpp.
void OpenNN::ConjugateGradient::set_maximum_generalization_evaluation_decreases | ( | const unsigned int & | new_maximum_generalization_evaluation_decreases | ) |
This method sets a new maximum number of generalization failures.
new_maximum_generalization_evaluation_decreases | Maximum number of epochs in which the generalization evalutation decreases. |
Definition at line 860 of file conjugate_gradient.cpp.
void OpenNN::ConjugateGradient::set_gradient_norm_goal | ( | const double & | new_gradient_norm_goal | ) |
This method sets a new the goal value for the norm of the objective function gradient. This is used as a stopping criterium when training a multilayer perceptron
new_gradient_norm_goal | Goal value for the norm of the objective function gradient. |
Definition at line 830 of file conjugate_gradient.cpp.
void OpenNN::ConjugateGradient::set_maximum_epochs_number | ( | const unsigned int & | new_maximum_epochs_number | ) |
This method sets a maximum number of epochs for training.
new_maximum_epochs_number | Maximum number of epochs for training. |
Definition at line 890 of file conjugate_gradient.cpp.
void OpenNN::ConjugateGradient::set_maximum_time | ( | const double & | new_maximum_time | ) |
This method sets a new maximum training time.
new_maximum_time | Maximum training time. |
Definition at line 920 of file conjugate_gradient.cpp.
void OpenNN::ConjugateGradient::set_reserve_parameters_history | ( | const bool & | new_reserve_parameters_history | ) |
This method 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 950 of file conjugate_gradient.cpp.
void OpenNN::ConjugateGradient::set_reserve_parameters_norm_history | ( | const bool & | new_reserve_parameters_norm_history | ) |
This method 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 961 of file conjugate_gradient.cpp.
void OpenNN::ConjugateGradient::set_reserve_evaluation_history | ( | const bool & | new_reserve_evaluation_history | ) |
This method makes the evaluation history vector to be reseved or not in memory.
new_reserve_evaluation_history | True if the evaluation history vector is to be reserved, false otherwise. |
Definition at line 972 of file conjugate_gradient.cpp.
void OpenNN::ConjugateGradient::set_reserve_generalization_evaluation_history | ( | const bool & | new_reserve_generalization_evaluation_history | ) |
This method makes the Generalization evaluation history to be reserved or not in memory. This is a vector.
new_reserve_generalization_evaluation_history | True if the Generalization evaluation history is to be reserved, false otherwise. |
Definition at line 1043 of file conjugate_gradient.cpp.
void OpenNN::ConjugateGradient::set_reserve_gradient_history | ( | const bool & | new_reserve_gradient_history | ) |
This method 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 983 of file conjugate_gradient.cpp.
void OpenNN::ConjugateGradient::set_reserve_gradient_norm_history | ( | const bool & | new_reserve_gradient_norm_history | ) |
This method 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 995 of file conjugate_gradient.cpp.
void OpenNN::ConjugateGradient::set_reserve_training_direction_history | ( | const bool & | new_reserve_training_direction_history | ) |
This method makes the training direction history vector of vectors to be reseved or not in memory.
new_reserve_training_direction_history | True if the training direction history matrix is to be reserved, false otherwise. |
Definition at line 1007 of file conjugate_gradient.cpp.
void OpenNN::ConjugateGradient::set_reserve_training_rate_history | ( | const bool & | new_reserve_training_rate_history | ) |
This method makes the training rate history vector to be reseved or not in memory.
new_reserve_training_rate_history | True if the training rate history vector is to be reserved, false otherwise. |
Definition at line 1019 of file conjugate_gradient.cpp.
void OpenNN::ConjugateGradient::set_reserve_elapsed_time_history | ( | const bool & | new_reserve_elapsed_time_history | ) |
This method makes the elapsed time over the epochs 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 1031 of file conjugate_gradient.cpp.
void OpenNN::ConjugateGradient::set_reserve_all_training_history | ( | const bool & | new_reserve_all_training_history | ) |
This method makes the training history of all variables to reseved or not in memory when training.
new_reserve_all_training_history | True if all training history variables are to be reserved, false otherwise. |
Definition at line 460 of file conjugate_gradient.cpp.
void OpenNN::ConjugateGradient::set_display_period | ( | const unsigned int & | new_display_period | ) |
This method sets a new number of epochs between the training showing progress.
new_display_period | Number of epochs between the training showing progress. |
Definition at line 1055 of file conjugate_gradient.cpp.
double OpenNN::ConjugateGradient::calculate_PR_parameter | ( | const Vector< double > & | old_gradient, | |
const Vector< double > & | gradient | |||
) | const |
This method returns the Polak-Ribiere parameter used to calculate the training direction.
old_gradient | Previous objective function gradient. | |
gradient | Current objective function gradient. |
Definition at line 1122 of file conjugate_gradient.cpp.
double OpenNN::ConjugateGradient::calculate_FR_parameter | ( | const Vector< double > & | old_gradient, | |
const Vector< double > & | gradient | |||
) | const |
This method returns the Fletcher-Reeves parameter used to calculate the training direction.
old_gradient | Previous objective function gradient. | |
gradient,: | Current objective function gradient. |
Definition at line 1086 of file conjugate_gradient.cpp.
Vector< double > OpenNN::ConjugateGradient::calculate_PR_training_direction | ( | const Vector< double > & | old_gradient, | |
const Vector< double > & | gradient, | |||
const Vector< double > & | old_training_direction | |||
) | const |
This method returns the training direction using the Polak-Ribiere update.
old_gradient | Previous objective function gradient. | |
gradient | Current objective function gradient. | |
old_training_direction | Previous training direction vector. |
Definition at line 1160 of file conjugate_gradient.cpp.
Vector< double > OpenNN::ConjugateGradient::calculate_FR_training_direction | ( | const Vector< double > & | old_gradient, | |
const Vector< double > & | gradient, | |||
const Vector< double > & | old_training_direction | |||
) | const |
This method returns the training direction using the Fletcher-Reeves update.
old_gradient | Previous objective function gradient. | |
gradient | Current objective function gradient. | |
old_training_direction | Previous training direction vector. |
Definition at line 1183 of file conjugate_gradient.cpp.
Vector< double > OpenNN::ConjugateGradient::calculate_training_direction | ( | const Vector< double > & | old_gradient, | |
const Vector< double > & | gradient, | |||
const Vector< double > & | old_training_direction | |||
) | const |
This method returns the conjugate gradient training direction, which has been previously normalized.
old_gradient | Gradient vector in the previous epoch. | |
gradient | Current gradient vector. | |
old_training_direction | Training direction in the previous epoch. |
Definition at line 1206 of file conjugate_gradient.cpp.
Vector< double > OpenNN::ConjugateGradient::calculate_gradient_descent_training_direction | ( | const Vector< double > & | gradient | ) | const |
This method returns the gradient descent training direction, which is the negative of the normalized gradient.
gradient | Gradient vector. |
Definition at line 1242 of file conjugate_gradient.cpp.
ConjugateGradient::ConjugateGradientResults * OpenNN::ConjugateGradient::perform_training | ( | void | ) | [virtual] |
This method trains a neural network with an associated performance functional according to the conjugate gradient algorithm. Training occurs according to the training operators, training parameters and stopping criteria.
Implements OpenNN::TrainingAlgorithm.
Definition at line 1367 of file conjugate_gradient.cpp.
std::string OpenNN::ConjugateGradient::write_training_algorithm_type | ( | void | ) | const [virtual] |
This method writes a string with the type of training algoritm.
Reimplemented from OpenNN::TrainingAlgorithm.
Definition at line 1773 of file conjugate_gradient.cpp.
TiXmlElement * OpenNN::ConjugateGradient::to_XML | ( | void | ) | const [virtual] |
This method serializes the conjugate gradient object into a XML element of the TinyXML library. See the OpenNN manual for more information about the format of this element.
Reimplemented from OpenNN::TrainingAlgorithm.
Definition at line 1784 of file conjugate_gradient.cpp.
void OpenNN::ConjugateGradient::from_XML | ( | TiXmlElement * | conjugate_gradient_element | ) | [virtual] |
This method deserializes the conjugate gradient object from a XML element of the TinyXML library. See the OpenNN manual for more information about the format of this element.
conjugate_gradient_element | Pointer to a TinyXML element containing the member data. |
Reimplemented from OpenNN::TrainingAlgorithm.
Definition at line 2106 of file conjugate_gradient.cpp.