OpenNN::TrainingStrategy Class Reference

#include <training_strategy.h>

List of all members.

Classes

struct  Results

Public Types

enum  TrainingAlgorithmType {
  NONE, RANDOM_SEARCH, EVOLUTIONARY_ALGORITHM, GRADIENT_DESCENT,
  CONJUGATE_GRADIENT, QUASI_NEWTON_METHOD, LEVENBERG_MARQUARDT_ALGORITHM, NEWTON_METHOD,
  USER_TRAINING_ALGORITHM
}

Public Member Functions

 TrainingStrategy (void)
 TrainingStrategy (PerformanceFunctional *)
 TrainingStrategy (TiXmlElement *)
 TrainingStrategy (const std::string &)
virtual ~TrainingStrategy (void)
PerformanceFunctionalget_performance_functional_pointer (void) const
TrainingAlgorithmget_initialization_training_algorithm_pointer (void) const
TrainingAlgorithmget_main_training_algorithm_pointer (void) const
TrainingAlgorithmget_refinement_training_algorithm_pointer (void) const
const TrainingAlgorithmTypeget_initialization_training_algorithm_type (void) const
const TrainingAlgorithmTypeget_main_training_algorithm_type (void) const
const TrainingAlgorithmTypeget_refinement_training_algorithm_type (void) const
std::string write_initialization_training_algorithm_type (void) const
std::string write_main_training_algorithm_type (void) const
std::string write_refinement_training_algorithm_type (void) const
const bool & get_initialization_training_algorithm_flag (void)
const bool & get_main_training_algorithm_flag (void)
const bool & get_refinement_training_algorithm_flag (void)
const bool & get_display (void) const
void set (void)
void set (PerformanceFunctional *)
virtual void set_default (void)
void set_performance_functional_pointer (PerformanceFunctional *)
void set_initialization_training_algorithm_pointer (TrainingAlgorithm *)
void set_main_training_algorithm_pointer (TrainingAlgorithm *)
void set_refinement_training_algorithm_pointer (TrainingAlgorithm *)
void set_initialization_training_algorithm_type (const TrainingAlgorithmType &)
void set_main_training_algorithm_type (const TrainingAlgorithmType &)
void set_refinement_training_algorithm_type (const TrainingAlgorithmType &)
void set_initialization_training_algorithm_type (const std::string &)
void set_main_training_algorithm_type (const std::string &)
void set_refinement_training_algorithm_type (const std::string &)
void set_initialization_training_algorithm_flag (const bool &)
void set_main_training_algorithm_flag (const bool &)
void set_refinement_training_algorithm_flag (const bool &)
void set_display (const bool &)
void construct_initialization_training_algorithm (const TrainingAlgorithmType &)
void construct_main_training_algorithm (const TrainingAlgorithmType &)
void construct_refinement_training_algorithm (const TrainingAlgorithmType &)
void destruct_initialization_training_algorithm (void)
void destruct_main_training_algorithm (void)
void destruct_refinement_training_algorithm (void)
Results perform_training (void)
std::string to_string (void) const
void print (void) const
virtual TiXmlElement * to_XML (void) const
virtual void from_XML (TiXmlElement *)
void save (const std::string &) const
void load (const std::string &)

Protected Attributes

PerformanceFunctionalperformance_functional_pointer
TrainingAlgorithminitialization_training_algorithm_pointer
TrainingAlgorithmmain_training_algorithm_pointer
TrainingAlgorithmrefinement_training_algorithm_pointer
TrainingAlgorithmType initialization_training_algorithm_type
TrainingAlgorithmType main_training_algorithm_type
TrainingAlgorithmType refinement_training_algorithm_type
bool initialization_training_algorithm_flag
bool main_training_algorithm_flag
bool refinement_training_algorithm_flag
bool display


Detailed Description

This class represents the concept of training strategy for a neural network. A training strategy is composed of three training algorithms:

Definition at line 40 of file training_strategy.h.


Member Enumeration Documentation

Enumeration of all the available types of training algorithms.

Definition at line 69 of file training_strategy.h.


Constructor & Destructor Documentation

OpenNN::TrainingStrategy::TrainingStrategy ( void   )  [explicit]

Default constructor. It creates a training strategy object not associated to any performance functional object. It also constructs the main training algorithm object.

Definition at line 53 of file training_strategy.cpp.

OpenNN::TrainingStrategy::TrainingStrategy ( PerformanceFunctional new_performance_functional_pointer  )  [explicit]

Performance functional constructor. It creates a training strategy object associated to a performance functional object. It also constructs the main training algorithm object.

Parameters:
new_performance_functional_pointer Pointer to a performance functional object.

Definition at line 72 of file training_strategy.cpp.

OpenNN::TrainingStrategy::TrainingStrategy ( TiXmlElement *  training_strategy_element  )  [explicit]

XML constructor. It creates a training strategy object not associated to any performance functional object. It also loads the members of this object from a XML element.

Parameters:
training_strategy_element Pointer to an element of the Tiny XML library.

Definition at line 91 of file training_strategy.cpp.

OpenNN::TrainingStrategy::TrainingStrategy ( const std::string &  filename  )  [explicit]

File constructor. It creates a training strategy object associated to a performance functional object. It also loads the members of this object from a XML file.

Parameters:
filename Name of training strategy XML file.

Definition at line 111 of file training_strategy.cpp.

OpenNN::TrainingStrategy::~TrainingStrategy ( void   )  [virtual]

Destructor. This destructor deletes the initialization, main and refinement training algorithm objects.

Definition at line 128 of file training_strategy.cpp.


Member Function Documentation

PerformanceFunctional * OpenNN::TrainingStrategy::get_performance_functional_pointer ( void   )  const

This method returns a pointer to the performance functional object to which the training strategy is associated.

Definition at line 142 of file training_strategy.cpp.

TrainingAlgorithm * OpenNN::TrainingStrategy::get_initialization_training_algorithm_pointer ( void   )  const

This method returns a pointer to the initialization training algorithm object composing this training strategy object.

Definition at line 152 of file training_strategy.cpp.

TrainingAlgorithm * OpenNN::TrainingStrategy::get_main_training_algorithm_pointer ( void   )  const

This method returns a pointer to the main training algorithm object composing this training strategy object.

Definition at line 162 of file training_strategy.cpp.

TrainingAlgorithm * OpenNN::TrainingStrategy::get_refinement_training_algorithm_pointer ( void   )  const

This method returns a pointer to the refinement training algorithm object composing this training strategy object.

Definition at line 172 of file training_strategy.cpp.

const TrainingStrategy::TrainingAlgorithmType & OpenNN::TrainingStrategy::get_initialization_training_algorithm_type ( void   )  const

This method returns the type of the initialization training algorithm composing this training strategy object.

Definition at line 182 of file training_strategy.cpp.

const TrainingStrategy::TrainingAlgorithmType & OpenNN::TrainingStrategy::get_main_training_algorithm_type ( void   )  const

This method returns the type of the main training algorithm composing this training strategy object.

Definition at line 192 of file training_strategy.cpp.

const TrainingStrategy::TrainingAlgorithmType & OpenNN::TrainingStrategy::get_refinement_training_algorithm_type ( void   )  const

This method returns the type of the refinement training algorithm composing this training strategy object.

Definition at line 202 of file training_strategy.cpp.

std::string OpenNN::TrainingStrategy::write_initialization_training_algorithm_type ( void   )  const

This method returns a string with the type of the initialization training algorithm composing this training strategy object.

Definition at line 212 of file training_strategy.cpp.

std::string OpenNN::TrainingStrategy::write_main_training_algorithm_type ( void   )  const

This method returns a string with the type of the main training algorithm composing this training strategy object.

Definition at line 267 of file training_strategy.cpp.

std::string OpenNN::TrainingStrategy::write_refinement_training_algorithm_type ( void   )  const

This method returns a string with the type of the refinement training algorithm composing this training strategy object.

Definition at line 322 of file training_strategy.cpp.

const bool & OpenNN::TrainingStrategy::get_initialization_training_algorithm_flag ( void   ) 

This method returns the flag value for applying or not the initialization training algorithm within the training strategy.

Definition at line 377 of file training_strategy.cpp.

const bool & OpenNN::TrainingStrategy::get_main_training_algorithm_flag ( void   ) 

This method returns the flag value for applying or not the main training algorithm within the training strategy.

Definition at line 387 of file training_strategy.cpp.

const bool & OpenNN::TrainingStrategy::get_refinement_training_algorithm_flag ( void   ) 

This method returns the flag value for applying or not the refinement training algorithm within the training strategy.

Definition at line 397 of file training_strategy.cpp.

const bool & OpenNN::TrainingStrategy::get_display ( void   )  const

This method returns true if messages from this class can be displayed on the screen, or false if messages from this class can't be displayed on the screen.

Definition at line 408 of file training_strategy.cpp.

void OpenNN::TrainingStrategy::set ( void   ) 

This method sets the performance functional pointer to NULL. It also destructs the initialization, main and refinement training algorithms. Finally, it sets the rest of members to their default values.

Definition at line 420 of file training_strategy.cpp.

void OpenNN::TrainingStrategy::set ( PerformanceFunctional new_performance_functional_pointer  ) 

This method sets a new performance functional pointer. It also destructs the initialization, main and refinement training algorithms. Finally, it sets the rest of members to their default values.

Parameters:
new_performance_functional_pointer Pointer to a performance functional object.

Definition at line 439 of file training_strategy.cpp.

void OpenNN::TrainingStrategy::set_default ( void   )  [virtual]

This method sets the members of the training strategy object to their default values:

  • Initialization training algorithm type: None.
  • Main training algorithm type: Quasi-Newton method.
  • Refinement training algorithm type: None.
  • Initialization training algorithm flag: false.
  • Main training algorithm flag: true.
  • Refinement training algorithm flag: false.
  • Display: true.

Definition at line 761 of file training_strategy.cpp.

void OpenNN::TrainingStrategy::set_performance_functional_pointer ( PerformanceFunctional new_performance_functional_pointer  ) 

This method sets a pointer to a performance functional object to be associated to the training strategy.

Parameters:
new_performance_functional_pointer Pointer to a performance functional object.

Definition at line 696 of file training_strategy.cpp.

void OpenNN::TrainingStrategy::set_initialization_training_algorithm_pointer ( TrainingAlgorithm new_initialization_training_algorithm_pointer  ) 

This method sets a new initialization training algorithm to be part of the training strategy. Note that the training algorithms are deleted by the training strategy destructor.

Definition at line 707 of file training_strategy.cpp.

void OpenNN::TrainingStrategy::set_main_training_algorithm_pointer ( TrainingAlgorithm new_main_training_algorithm_pointer  ) 

This method sets a new main training algorithm to be part of the training strategy. Note that the training algorithms are deleted by the training strategy destructor.

Definition at line 718 of file training_strategy.cpp.

void OpenNN::TrainingStrategy::set_refinement_training_algorithm_pointer ( TrainingAlgorithm new_refinement_training_algorithm_pointer  ) 

This method sets a new refinement training algorithm to be part of the training strategy. Note that the training algorithms are deleted by the training strategy destructor.

Definition at line 729 of file training_strategy.cpp.

void OpenNN::TrainingStrategy::set_initialization_training_algorithm_type ( const TrainingAlgorithmType new_initialization_training_algorithm_type  ) 

This method sets a new type of initialization training algorithm. Note that it neither sets the training algorithm object nor the flag.

Parameters:
new_initialization_training_algorithm_type Type of initialization training algorithm.

Definition at line 490 of file training_strategy.cpp.

void OpenNN::TrainingStrategy::set_main_training_algorithm_type ( const TrainingAlgorithmType new_main_training_algorithm_type  ) 

This method sets a new type of main training algorithm. Note that it neither sets the training algorithm object nor the flag.

Parameters:
new_main_training_algorithm_type Type of main training algorithm.

Definition at line 502 of file training_strategy.cpp.

void OpenNN::TrainingStrategy::set_refinement_training_algorithm_type ( const TrainingAlgorithmType new_refinement_training_algorithm_type  ) 

This method sets a new type of refinement training algorithm. Note that it neither sets the training algorithm object nor the flag.

Parameters:
new_refinement_training_algorithm_type Type of refinement training algorithm.

Definition at line 514 of file training_strategy.cpp.

void OpenNN::TrainingStrategy::set_initialization_training_algorithm_type ( const std::string &  new_training_algorithm_type  ) 

This method sets the initialization training algorithm type from a string. Note that it neither sets the training algorithm object nor the flag.

Parameters:
new_training_algorithm_type String with the initialization training algorithm type.

Definition at line 526 of file training_strategy.cpp.

void OpenNN::TrainingStrategy::set_main_training_algorithm_type ( const std::string &  new_training_algorithm_type  ) 

This method sets the main training algorithm type from a string. Note that it neither sets the training algorithm object nor the flag.

Parameters:
new_training_algorithm_type String with the main training algorithm type.

Definition at line 583 of file training_strategy.cpp.

void OpenNN::TrainingStrategy::set_refinement_training_algorithm_type ( const std::string &  new_training_algorithm_type  ) 

This method sets the refinement training algorithm type from a string. Note that it neither sets the training algorithm object nor the flag.

Parameters:
new_training_algorithm_type String with the refinement training algorithm type.

Definition at line 640 of file training_strategy.cpp.

void OpenNN::TrainingStrategy::set_initialization_training_algorithm_flag ( const bool &  new_initialization_training_algorithm_flag  ) 

This method sets a new flag for using the initialization training algorithm within the training strategy.

Parameters:
new_initialization_training_algorithm_flag Flag for using or not this algorithm within the strategy.

Definition at line 456 of file training_strategy.cpp.

void OpenNN::TrainingStrategy::set_main_training_algorithm_flag ( const bool &  new_main_training_algorithm_flag  ) 

This method sets a new flag for using the main training algorithm within the training strategy.

Parameters:
new_main_training_algorithm_flag Flag for using or not this algorithm within the strategy.

Definition at line 467 of file training_strategy.cpp.

void OpenNN::TrainingStrategy::set_refinement_training_algorithm_flag ( const bool &  new_refinement_training_algorithm_flag  ) 

This method sets a new flag for using the refinement training algorithm within the training strategy.

Parameters:
new_refinement_training_algorithm_flag Flag for using or not this algorithm within the strategy.

Definition at line 478 of file training_strategy.cpp.

void OpenNN::TrainingStrategy::set_display ( const bool &  new_display  ) 

This method sets a new display value. If it is set to true messages from this class are to be displayed on the screen; if it is set to false messages from this class are not to be displayed on the screen.

Parameters:
new_display Display value.

Definition at line 742 of file training_strategy.cpp.

void OpenNN::TrainingStrategy::construct_initialization_training_algorithm ( const TrainingAlgorithmType new_training_algorithm_type  ) 

This method constructs the initialization training algorithm object, given its type. It also sets the type of that training algorithm. Finally, it sets the initialization training algorithm flag to true.

Parameters:
new_training_algorithm_type Type of initialization training algorithm.

Definition at line 782 of file training_strategy.cpp.

void OpenNN::TrainingStrategy::construct_main_training_algorithm ( const TrainingAlgorithmType new_training_algorithm_type  ) 

This method constructs the main training algorithm object, given its type. It also sets the type of that training algorithm. Finally, it sets the main training algorithm flag to true.

Parameters:
new_training_algorithm_type Type of main training algorithm.

Definition at line 864 of file training_strategy.cpp.

void OpenNN::TrainingStrategy::construct_refinement_training_algorithm ( const TrainingAlgorithmType new_training_algorithm_type  ) 

This method constructs the refinement training algorithm object, given its type. It also sets the type of that training algorithm. Finally, it sets the refinement training algorithm flag to true.

Parameters:
new_training_algorithm_type Type of refinement training algorithm.

Definition at line 946 of file training_strategy.cpp.

void OpenNN::TrainingStrategy::destruct_initialization_training_algorithm ( void   ) 

This method deletes the initialization training algorithm object which composes this training strategy object.

Definition at line 1025 of file training_strategy.cpp.

void OpenNN::TrainingStrategy::destruct_main_training_algorithm ( void   ) 

This method deletes the main training algorithm object which composes this training strategy object.

Definition at line 1041 of file training_strategy.cpp.

void OpenNN::TrainingStrategy::destruct_refinement_training_algorithm ( void   ) 

This method deletes the refinement training algorithm object which composes this training strategy object.

Definition at line 1057 of file training_strategy.cpp.

TrainingStrategy::Results OpenNN::TrainingStrategy::perform_training ( void   ) 

This is the most important method of this class. It optimizes the performance functional of a neural network. The most general training strategy consists of three steps: initialization, main and refinement training processes. This method also returns a structure with the results from training.

Definition at line 1076 of file training_strategy.cpp.

std::string OpenNN::TrainingStrategy::to_string ( void   )  const

This method returns a string representation of the training strategy.

Definition at line 1153 of file training_strategy.cpp.

void OpenNN::TrainingStrategy::print ( void   )  const

This method prints to the screen the string representation of the training strategy object.

Definition at line 1191 of file training_strategy.cpp.

TiXmlElement * OpenNN::TrainingStrategy::to_XML ( void   )  const [virtual]

This method returns a default string representation in XML-type format of the training algorithm object. This containts the training operators, the training parameters, stopping criteria and other stuff.

Definition at line 1202 of file training_strategy.cpp.

void OpenNN::TrainingStrategy::from_XML ( TiXmlElement *  training_strategy_element  )  [virtual]

This method loads the members of this training strategy object from a XML element.

Parameters:
training_strategy_element Pointer to a XML element of the TinyXML library.

Definition at line 1328 of file training_strategy.cpp.

void OpenNN::TrainingStrategy::save ( const std::string &  filename  )  const

This method saves to a XML-type file the members of the training algorithm object.

Parameters:
filename Name of training algorithm XML-type file.

Definition at line 1502 of file training_strategy.cpp.

void OpenNN::TrainingStrategy::load ( const std::string &  filename  ) 

This method loads a gradient descent object from a XML-type file. Please mind about the file format, wich is specified in the User's Guide.

Parameters:
filename Name of training algorithm XML-type file.

Definition at line 1528 of file training_strategy.cpp.


Member Data Documentation

Pointer to an external performance functional object.

Definition at line 187 of file training_strategy.h.

Pointer to an internal training algorithm object to be used for initialization purposes.

Definition at line 191 of file training_strategy.h.

Pointer to an internal training algorithm object to be used for main training.

Definition at line 195 of file training_strategy.h.

Pointer to an internal training algorithm object to be used for refinement purposes.

Definition at line 199 of file training_strategy.h.

Type of initialization training algorithm.

Definition at line 204 of file training_strategy.h.

Type of main training algorithm.

Definition at line 208 of file training_strategy.h.

Type of refinement training algorithm.

Definition at line 212 of file training_strategy.h.

Flag for using or not the initialization training algorithm within the training strategy.

Definition at line 217 of file training_strategy.h.

Flag for using or not the main training algorithm within the training strategy.

Definition at line 221 of file training_strategy.h.

Flag for using or not the refinement training algorithm within the training strategy.

Definition at line 225 of file training_strategy.h.

Display messages to screen.

Definition at line 230 of file training_strategy.h.


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

Generated on Sun Aug 26 11:58:21 2012 for OpenNN by  doxygen 1.5.9