#include <ConjugateGradient.h>
Public Types | |
enum | TrainingDirectionMethod { PolakRibiere, FletcherReeves } |
Public Member Functions | |
ConjugateGradient (ObjectiveFunctional *) | |
ConjugateGradient (void) | |
virtual | ~ConjugateGradient (void) |
TrainingDirectionMethod | get_training_direction_method (void) |
std::string | get_training_direction_method_name (void) |
void | set_training_direction_method (const TrainingDirectionMethod &) |
void | set_training_direction_method (const std::string &) |
double | calculate_Polak_Ribiere_parameter (const Vector< double > &, const Vector< double > &) |
double | calculate_Fletcher_Reeves_parameter (const Vector< double > &, const Vector< double > &) |
Vector< double > | calculate_Polak_Ribiere_training_direction (const Vector< double > &, const Vector< double > &, const Vector< double > &) |
Vector< double > | calculate_Fletcher_Reeves_training_direction (const Vector< double > &, const Vector< double > &, const Vector< double > &) |
Vector< double > | calculate_training_direction (const Vector< double > &, const Vector< double > &, const Vector< double > &) |
Vector< double > | calculate_gradient_descent_training_direction (const Vector< double > &) |
void | train (void) |
void | set_reserve_all_training_history (bool) |
void | resize_training_history (int) |
std::string | get_training_history_XML (bool) |
std::string | to_XML (bool) |
void | load (const char *) |
Definition at line 29 of file ConjugateGradient.h.
Enumeration of the available training operators for obtaining the training direction.
Definition at line 38 of file ConjugateGradient.h.
Flood::ConjugateGradient::ConjugateGradient | ( | ObjectiveFunctional * | new_objective_functional_pointer | ) | [explicit] |
General constructor. It creates a conjugate gradient training algorithm object associated to an objective functional object. It also initializes the class members to their default values:
Training operators:
Training parameters:
Stopping criteria:
User stuff:
Reserve:
new_objective_functional_pointer | Pointer to an objective functional object. |
Definition at line 75 of file ConjugateGradient.cpp.
Flood::ConjugateGradient::ConjugateGradient | ( | void | ) | [explicit] |
Default constructor. It creates a conjugate gradient training algorithm object not associated to any objective functional object. It also initializes the class members to their default values:
Training operators:
Training parameters:
Stopping criteria:
User stuff:
Reserve:
Definition at line 126 of file ConjugateGradient.cpp.
Flood::ConjugateGradient::~ConjugateGradient | ( | void | ) | [virtual] |
double Flood::ConjugateGradient::calculate_Fletcher_Reeves_parameter | ( | const Vector< double > & | old_gradient, | |
const Vector< double > & | gradient | |||
) |
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 281 of file ConjugateGradient.cpp.
Vector< double > Flood::ConjugateGradient::calculate_Fletcher_Reeves_training_direction | ( | const Vector< double > & | old_gradient, | |
const Vector< double > & | gradient, | |||
const Vector< double > & | old_training_direction | |||
) |
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 382 of file ConjugateGradient.cpp.
double Flood::ConjugateGradient::calculate_Polak_Ribiere_parameter | ( | const Vector< double > & | old_gradient, | |
const Vector< double > & | gradient | |||
) |
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 319 of file ConjugateGradient.cpp.
Vector< double > Flood::ConjugateGradient::calculate_Polak_Ribiere_training_direction | ( | const Vector< double > & | old_gradient, | |
const Vector< double > & | gradient, | |||
const Vector< double > & | old_training_direction | |||
) |
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 358 of file ConjugateGradient.cpp.
ConjugateGradient::TrainingDirectionMethod Flood::ConjugateGradient::get_training_direction_method | ( | void | ) |
This method returns the conjugate gradient training direction method used for training.
Definition at line 149 of file ConjugateGradient.cpp.
std::string Flood::ConjugateGradient::get_training_direction_method_name | ( | void | ) |
This method returns a string with the name of the training direction.
Definition at line 159 of file ConjugateGradient.cpp.
std::string Flood::ConjugateGradient::get_training_history_XML | ( | bool | show_declaration | ) | [virtual] |
This method returns a string representation of the training history in XML-type format.
show_declaration | True if an XML-type declaration is to be included at the beginning of the string. |
Reimplemented from Flood::TrainingAlgorithm.
Definition at line 1574 of file ConjugateGradient.cpp.
void Flood::ConjugateGradient::load | ( | const char * | filename | ) | [virtual] |
This method loads a conjugate gradient object from an XML-type file. Please mind about the file format, wich is specified in the User's Guide.
filename | Name of conjugate gradient XML-type. |
Reimplemented from Flood::TrainingAlgorithm.
Definition at line 966 of file ConjugateGradient.cpp.
void Flood::ConjugateGradient::resize_training_history | ( | int | new_size | ) | [virtual] |
This method resizes the vectors of training history variables to a new size. Only those reserved variablers will be resized.
new_size | Size of training history. |
Reimplemented from Flood::TrainingAlgorithm.
Definition at line 1512 of file ConjugateGradient.cpp.
void Flood::ConjugateGradient::set_reserve_all_training_history | ( | bool | new_reserve_all_training_history | ) | [virtual] |
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. |
Reimplemented from Flood::TrainingAlgorithm.
Definition at line 250 of file ConjugateGradient.cpp.
void Flood::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 211 of file ConjugateGradient.cpp.
void Flood::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 195 of file ConjugateGradient.cpp.
std::string Flood::ConjugateGradient::to_XML | ( | bool | show_declaration | ) | [virtual] |
This method returns a string representation of the conjuage gradient object in a XML formnat. See the user's guide.
show_declaration | True if an XML-type declaration is to be included at the beginning. |
Reimplemented from Flood::TrainingAlgorithm.
Definition at line 840 of file ConjugateGradient.cpp.
void Flood::ConjugateGradient::train | ( | void | ) | [virtual] |
This method trains a multilayer perceptron with an associated evaluation function according to the conjugate gradient algorithm. Training occurs according to the training operators, training parameters and stopping criteria.
Implements Flood::TrainingAlgorithm.
Definition at line 444 of file ConjugateGradient.cpp.