Flood::ConjugateGradient Class Reference

#include <ConjugateGradient.h>

Inheritance diagram for Flood::ConjugateGradient:

Flood::TrainingAlgorithm

List of all members.

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 *)


Detailed Description

This concrete class represents a conjugate gradient training algorithm for an objective functional of a multilayer perceptron.

Definition at line 29 of file ConjugateGradient.h.


Member Enumeration Documentation

Enumeration of the available training operators for obtaining the training direction.

Definition at line 38 of file ConjugateGradient.h.


Constructor & Destructor Documentation

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 direction method = Polak-Ribiere;
  • Training rate method = Brent;

Training parameters:

  • First training rate: 1.0.
  • Bracketing factor: 2.0.
  • Training rate tolerance: 1.0e-3.

Stopping criteria:

  • Evaluation goal: -1.0e99.
  • Gradient norm goal: 0.0.
  • Maximum training time: 1.0e6.
  • Maximum number of epochs: 100.

User stuff:

  • Warning training rate: 1.0e6.
  • Error training rate: 1.0e12.
  • Display: true.
  • Display period: 25.

Reserve:

  • Reserve training direction history: false.
  • Reserve training direction norm history: false.
  • Reserve training rate history: false.

Parameters:
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 direction method = Polak-Ribiere;
  • Training rate method = Brent;

Training parameters:

  • First training rate: 1.0.
  • Bracketing factor: 2.0.
  • Training rate tolerance: 1.0e-3.

Stopping criteria:

  • Evaluation goal: -1.0e99.
  • Gradient norm goal: 0.0.
  • Maximum training time: 1.0e6.
  • Maximum number of epochs: 100.

User stuff:

  • Warning training rate: 1.0e6.
  • Error training rate: 1.0e12.
  • Display: true.
  • Display period: 25.

Reserve:

  • Reserve training direction history: false.
  • Reserve training direction norm history: false.
  • Reserve training rate history: false.

Definition at line 126 of file ConjugateGradient.cpp.

Flood::ConjugateGradient::~ConjugateGradient ( void   )  [virtual]

Destructor.

Definition at line 138 of file ConjugateGradient.cpp.


Member Function Documentation

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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

  • Parameters.
  • Parameters norm.
  • Evaluation.
  • Gradient.
  • Gradient norm.
  • Validation error.
  • Training direction.
  • Training direction norm.
  • Training rate.

Parameters:
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:

  • "PolakRibiere"
  • "FletcherReeves"
Parameters:
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.

Parameters:
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.

Parameters:
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.


The documentation for this class was generated from the following files:

Generated on Fri Jul 30 09:51:58 2010 for Flood by  doxygen 1.5.9