14 #ifndef __CONJUGATEGRADIENT_H__
15 #define __CONJUGATEGRADIENT_H__
31 #include "performance_functional.h"
33 #include "training_algorithm.h"
34 #include "training_rate_algorithm.h"
38 #include "../tinyxml2/tinyxml2.h"
321 tinyxml2::XMLDocument*
to_XML(
void)
const;
322 void from_XML(
const tinyxml2::XMLDocument&);
Vector< double > calculate_FR_training_direction(const Vector< double > &, const Vector< double > &, const Vector< double > &) const
TrainingDirectionMethod training_direction_method
Applied method for calculating the conjugate gradient direction.
Vector< double > calculate_training_direction(const Vector< double > &, const Vector< double > &, const Vector< double > &) const
void set_gradient_norm_goal(const double &)
virtual ~ConjugateGradientResults(void)
Destructor.
ConjugateGradientResults(void)
Default constructor.
void set_performance_goal(const double &)
const double & get_warning_parameters_norm(void) const
Returns the minimum value for the norm of the parameters vector at wich a warning message is written ...
double warning_training_rate
Training rate value at wich a warning message is written to the screen.
Vector< Vector< double > > gradient_history
History of the performance function gradient over the training iterations.
double elapsed_time
Elapsed time of the training process.
const bool & get_reserve_performance_history(void) const
Returns true if the performance history vector is to be reserved, and false otherwise.
Matrix< std::string > write_final_results(const size_t &precision=3) const
Returns a default (empty) string matrix with the final results from training.
double maximum_time
Maximum training time. It is used as a stopping criterion.
Vector< double > gradient_norm_history
History of the gradient norm over the training iterations.
const TrainingDirectionMethod & get_training_direction_method(void) const
Returns the conjugate gradient training direction method used for training.
void from_XML(const tinyxml2::XMLDocument &)
const bool & get_reserve_training_rate_history(void) const
Returns true if the training rate history vector is to be reserved, and false otherwise.
void set_reserve_training_rate_history(const bool &)
const bool & get_reserve_parameters_history(void) const
Returns true if the parameters history matrix is to be reserved, and false otherwise.
double error_parameters_norm
Value for the parameters norm at which the training process is assumed to fail.
double error_training_rate
Training rate at wich the line minimization algorithm is assumed to be unable to bracket a minimum...
double warning_parameters_norm
Value for the parameters norm at which a warning message is written to the screen.
const double & get_minimum_performance_increase(void) const
Returns the minimum performance improvement during training.
double calculate_FR_parameter(const Vector< double > &, const Vector< double > &) const
void set_reserve_gradient_history(const bool &)
void set_reserve_parameters_norm_history(const bool &)
bool reserve_parameters_history
True if the parameters history matrix is to be reserved, false otherwise.
double final_parameters_norm
Final neural network parameters norm.
const double & 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...
const double & get_gradient_norm_goal(void) const
std::string to_string(void) const
Returns a string representation of the results structure.
const bool & get_reserve_generalization_performance_history(void) const
Returns true if the Generalization performance history vector is to be reserved, and false otherwise...
void set_warning_parameters_norm(const double &)
double minimum_parameters_increment_norm
Norm of the parameters increment vector at which training stops.
Vector< double > calculate_gradient_descent_training_direction(const Vector< double > &) const
void set_error_training_rate(const double &)
ConjugateGradient * conjugate_gradient_pointer
Pointer to the conjugate gradient object for which the training results are to be stored...
double performance_goal
Goal value for the performance. It is used as a stopping criterion.
double error_gradient_norm
Value for the gradient norm at which the training process is assumed to fail.
Vector< double > performance_history
History of the performance function performance over the training iterations.
const double & get_warning_training_rate(void) const
Returns the training rate value at wich a warning message is written to the screen during line minimi...
void set_reserve_generalization_performance_history(const bool &)
virtual ~ConjugateGradient(void)
Destructor.
void set_maximum_iterations_number(const size_t &)
Vector< Vector< double > > parameters_history
History of the neural network parameters over the training iterations.
const double & get_minimum_parameters_increment_norm(void) const
Returns the minimum norm of the parameter increment vector used as a stopping criteria when training...
void set_performance_functional_pointer(PerformanceFunctional *)
void resize_training_history(const size_t &)
bool reserve_parameters_norm_history
True if the parameters norm history vector is to be reserved, false otherwise.
bool reserve_gradient_norm_history
True if the gradient norm history vector is to be reserved, false otherwise.
double warning_gradient_norm
Value for the gradient norm at which a warning message is written to the screen.
ConjugateGradientResults * perform_training(void)
Vector< double > final_parameters
Final neural network parameters vector.
void set_error_parameters_norm(const double &)
ConjugateGradientResults(ConjugateGradient *new_conjugate_gradient_pointer)
Conjugate gradient constructor.
void set_maximum_generalization_performance_decreases(const size_t &)
void set_minimum_parameters_increment_norm(const double &)
void set_reserve_elapsed_time_history(const bool &)
Vector< double > calculate_PR_training_direction(const Vector< double > &, const Vector< double > &, const Vector< double > &) const
void set_minimum_performance_increase(const double &)
bool reserve_performance_history
True if the performance history vector is to be reserved, false otherwise.
std::string write_training_algorithm_type(void) const
This method writes a string with the type of training algoritm.
Vector< double > training_rate_history
History of the training rate over the training iterations.
size_t maximum_iterations_number
Maximum number of iterations to perform_training. It is used as a stopping criterion.
TrainingRateAlgorithm training_rate_algorithm
Training rate algorithm object for one-dimensional minimization.
const bool & get_reserve_gradient_history(void) const
Returns true if the gradient history vector of vectors is to be reserved, and false otherwise...
double calculate_PR_parameter(const Vector< double > &, const Vector< double > &) const
size_t maximum_generalization_performance_decreases
Vector< double > final_training_direction
Final conjugate gradient training direction.
const double & get_performance_goal(void) const
void set_training_direction_method(const TrainingDirectionMethod &)
const bool & get_reserve_gradient_norm_history(void) const
Returns true if the gradient norm history vector is to be reserved, and false otherwise.
Vector< double > final_gradient
Final performance function gradient.
size_t iterations_number
Maximum number of training iterations.
bool reserve_elapsed_time_history
True if the elapsed time history vector is to be reserved, false otherwise.
double final_training_rate
Final conjugate gradient training rate.
double minimum_performance_increase
Minimum performance improvement between two successive iterations. It is used as a stopping criterion...
Vector< double > generalization_performance_history
History of the generalization performance over the training iterations.
void set_warning_gradient_norm(const double &)
const size_t & get_maximum_generalization_performance_decreases(void) const
Returns the maximum number of generalization failures during the training process.
const bool & get_reserve_elapsed_time_history(void) const
Returns true if the elapsed time history vector is to be reserved, and false otherwise.
tinyxml2::XMLDocument * to_XML(void) const
Matrix< std::string > to_string_matrix(void) const
const bool & get_reserve_training_direction_history(void) const
Returns true if the training direction history matrix is to be reserved, and false otherwise...
std::string write_training_direction_method(void) const
Returns a string with the name of the training direction.
Vector< Vector< double > > training_direction_history
History of the conjugate gradient training direction over the training iterations.
double gradient_norm_goal
Goal value for the norm of the objective function gradient. It is used as a stopping criterion...
const TrainingRateAlgorithm & get_training_rate_algorithm(void) const
Returns a constant reference to the training rate algorithm object inside the conjugate gradient meth...
Vector< double > parameters_norm_history
History of the parameters norm over the training iterations.
void set_error_gradient_norm(const double &)
bool reserve_training_rate_history
True if the training rate history vector is to be reserved, false otherwise.
bool reserve_generalization_performance_history
True if the Generalization performance history vector is to be reserved, false otherwise.
double final_performance
Final performance function evaluation.
double final_gradient_norm
Final gradient norm.
void set_maximum_time(const double &)
const bool & get_reserve_parameters_norm_history(void) const
Returns true if the parameters norm history vector is to be reserved, and false otherwise.
bool reserve_training_direction_history
True if the training direction history matrix is to be reserved, false otherwise. ...
TrainingDirectionMethod
Enumeration of the available training operators for obtaining the training direction.
TrainingRateAlgorithm * get_training_rate_algorithm_pointer(void)
Returns a pointer to the training rate algorithm object inside the conjugate gradient method object...
void set_save_period(const size_t &)
void set_warning_training_rate(const double &)
const size_t & get_maximum_iterations_number(void) const
Returns the maximum number of iterations for training.
void set_reserve_gradient_norm_history(const bool &)
void set_reserve_all_training_history(const bool &)
bool reserve_gradient_history
True if the gradient history matrix is to be reserved, false otherwise.
void set_display_period(const size_t &)
const double & get_error_training_rate(void) const
const double & get_maximum_time(void) const
Returns the maximum training time.
double final_generalization_performance
Final generalization performance.
void set_reserve_parameters_history(const bool &)
void set_reserve_training_direction_history(const bool &)
void set_reserve_performance_history(const bool &)
const double & get_error_gradient_norm(void) const
const double & 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 sc...
Vector< double > elapsed_time_history
History of the elapsed time over the training iterations.