OpenNN  2.2
Open Neural Networks Library
Classes | Public Member Functions | Protected Attributes | List of all members
OpenNN::TrainingAlgorithm Class Referenceabstract

#include <training_algorithm.h>

Inheritance diagram for OpenNN::TrainingAlgorithm:
OpenNN::ConjugateGradient OpenNN::EvolutionaryAlgorithm OpenNN::GradientDescent OpenNN::LevenbergMarquardtAlgorithm OpenNN::NewtonMethod OpenNN::QuasiNewtonMethod OpenNN::RandomSearch

Classes

struct  TrainingAlgorithmResults
 

Public Member Functions

 TrainingAlgorithm (void)
 
 TrainingAlgorithm (PerformanceFunctional *)
 
 TrainingAlgorithm (const tinyxml2::XMLDocument &)
 
virtual ~TrainingAlgorithm (void)
 
virtual TrainingAlgorithmoperator= (const TrainingAlgorithm &)
 
virtual bool operator== (const TrainingAlgorithm &) const
 
PerformanceFunctionalget_performance_functional_pointer (void) const
 
bool has_performance_functional (void) const
 
const bool & get_display (void) const
 
const size_t & get_display_period (void) const
 
const size_t & get_save_period (void) const
 
const std::string & get_neural_network_file_name (void) const
 
void set (void)
 
void set (PerformanceFunctional *)
 
virtual void set_default (void)
 
virtual void set_performance_functional_pointer (PerformanceFunctional *)
 
void set_display (const bool &)
 
void set_display_period (const size_t &)
 
void set_save_period (const size_t &)
 
void set_neural_network_file_name (const std::string &)
 
virtual void check (void) const
 
virtual TrainingAlgorithmResultsperform_training (void)=0
 
virtual std::string write_training_algorithm_type (void) const
 
virtual std::string to_string (void) const
 
void print (void) const
 
virtual Matrix< std::string > to_string_matrix (void) const
 
virtual tinyxml2::XMLDocument * to_XML (void) const
 
virtual void from_XML (const tinyxml2::XMLDocument &)
 
void save (const std::string &) const
 
void load (const std::string &)
 
virtual void initialize_random (void)
 

Protected Attributes

PerformanceFunctionalperformance_functional_pointer
 
size_t display_period
 
size_t save_period
 
std::string neural_network_file_name
 
bool display
 

Detailed Description

This abstract class represents the concept of training algorithm for a neural network. Any derived class must implement the perform_training(void) method.

Definition at line 41 of file training_algorithm.h.

Constructor & Destructor Documentation

OpenNN::TrainingAlgorithm::TrainingAlgorithm ( void  )
explicit

Default constructor. It creates a training algorithm object not associated to any performance functional object.

Definition at line 27 of file training_algorithm.cpp.

OpenNN::TrainingAlgorithm::TrainingAlgorithm ( PerformanceFunctional new_performance_functional_pointer)
explicit

General constructor. It creates a training algorithm object associated to a performance functional object.

Parameters
new_performance_functional_pointerPointer to a performance functional object.

Definition at line 40 of file training_algorithm.cpp.

OpenNN::TrainingAlgorithm::TrainingAlgorithm ( const tinyxml2::XMLDocument &  document)
explicit

XML constructor. It creates a training algorithm object not associated to any performance functional object. It also loads the other members from a XML document.

Definition at line 53 of file training_algorithm.cpp.

Member Function Documentation

void OpenNN::TrainingAlgorithm::check ( void  ) const
virtual

Performs a default checking for training algorithms. In particular, it checks that the performance functional pointer associated to the training algorithm is not NULL, and that the neural network associated to that performance functional is neither NULL. If that checkings are not hold, an exception is thrown.

Reimplemented in OpenNN::LevenbergMarquardtAlgorithm.

Definition at line 348 of file training_algorithm.cpp.

void OpenNN::TrainingAlgorithm::from_XML ( const tinyxml2::XMLDocument &  document)
virtual

Loads a default training algorithm from a XML document.

Parameters
documentTinyXML document containing the performance term members.

Reimplemented in OpenNN::EvolutionaryAlgorithm, OpenNN::QuasiNewtonMethod, OpenNN::ConjugateGradient, OpenNN::NewtonMethod, OpenNN::LevenbergMarquardtAlgorithm, OpenNN::GradientDescent, and OpenNN::RandomSearch.

Definition at line 412 of file training_algorithm.cpp.

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

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 158 of file training_algorithm.cpp.

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

Returns a pointer to the performance functional object to which the training algorithm is associated.

Definition at line 114 of file training_algorithm.cpp.

bool OpenNN::TrainingAlgorithm::has_performance_functional ( void  ) const

Returns true if this training algorithm object has an associated performance functional object, and false otherwise.

Definition at line 140 of file training_algorithm.cpp.

void OpenNN::TrainingAlgorithm::initialize_random ( void  )
virtual

Default random initialization for a training algorithm object. It just sets a random display value.

Reimplemented in OpenNN::EvolutionaryAlgorithm.

Definition at line 534 of file training_algorithm.cpp.

void OpenNN::TrainingAlgorithm::load ( const std::string &  file_name)

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
file_nameName of training algorithm XML-type file.

Definition at line 508 of file training_algorithm.cpp.

TrainingAlgorithm & OpenNN::TrainingAlgorithm::operator= ( const TrainingAlgorithm other_training_algorithm)
virtual

Assignment operator. It assigns to this object the members of an existing training algorithm object.

Parameters
other_training_algorithmTraining algorithm object to be assigned.

Definition at line 75 of file training_algorithm.cpp.

bool OpenNN::TrainingAlgorithm::operator== ( const TrainingAlgorithm other_training_algorithm) const
virtual

Equal to operator.

Parameters
other_training_algorithmTraining algorithm object to be compared with.

Definition at line 93 of file training_algorithm.cpp.

void OpenNN::TrainingAlgorithm::save ( const std::string &  file_name) const

Saves to a XML-type file the members of the training algorithm object.

Parameters
file_nameName of training algorithm XML-type file.

Definition at line 492 of file training_algorithm.cpp.

void OpenNN::TrainingAlgorithm::set ( void  )

Sets the performance functional pointer to NULL. It also sets the rest of members to their default values.

Definition at line 199 of file training_algorithm.cpp.

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

Sets a new performance functional pointer. It also sets the rest of members to their default values.

Parameters
new_performance_functional_pointerPointer to a performance functional object.

Definition at line 213 of file training_algorithm.cpp.

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

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_displayDisplay value.

Definition at line 239 of file training_algorithm.cpp.

void OpenNN::TrainingAlgorithm::set_display_period ( const size_t &  new_display_period)

Sets a new number of iterations between the training showing progress.

Parameters
new_display_periodNumber of iterations between the training showing progress.

Definition at line 251 of file training_algorithm.cpp.

void OpenNN::TrainingAlgorithm::set_neural_network_file_name ( const std::string &  new_neural_network_file_name)

Sets a new file name where the neural network will be saved.

Parameters
new_neural_network_file_nameFile name for the neural network object.

Definition at line 309 of file training_algorithm.cpp.

void OpenNN::TrainingAlgorithm::set_performance_functional_pointer ( PerformanceFunctional new_performance_functional_pointer)
virtual

Sets a pointer to a performance functional object to be associated to the training algorithm.

Parameters
new_performance_functional_pointerPointer to a performance functional object.

Reimplemented in OpenNN::QuasiNewtonMethod, OpenNN::ConjugateGradient, OpenNN::NewtonMethod, and OpenNN::GradientDescent.

Definition at line 226 of file training_algorithm.cpp.

void OpenNN::TrainingAlgorithm::set_save_period ( const size_t &  new_save_period)

Sets a new number of iterations between the training saving progress.

Parameters
new_save_periodNumber of iterations between the training saving progress.

Definition at line 280 of file training_algorithm.cpp.

Matrix< std::string > OpenNN::TrainingAlgorithm::to_string_matrix ( void  ) const
virtual

Returns a default (empty) string matrix containing the members of the training algorithm object.

Reimplemented in OpenNN::EvolutionaryAlgorithm, OpenNN::QuasiNewtonMethod, OpenNN::ConjugateGradient, OpenNN::NewtonMethod, OpenNN::LevenbergMarquardtAlgorithm, OpenNN::GradientDescent, and OpenNN::RandomSearch.

Definition at line 469 of file training_algorithm.cpp.

tinyxml2::XMLDocument * OpenNN::TrainingAlgorithm::to_XML ( void  ) const
virtual

Serializes a default training algorithm object into a XML document of the TinyXML library. See the OpenNN manual for more information about the format of this document.

Reimplemented in OpenNN::EvolutionaryAlgorithm, OpenNN::QuasiNewtonMethod, OpenNN::ConjugateGradient, OpenNN::NewtonMethod, OpenNN::LevenbergMarquardtAlgorithm, OpenNN::GradientDescent, and OpenNN::RandomSearch.

Definition at line 379 of file training_algorithm.cpp.


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