OpenNN
2.2
Open Neural Networks Library
|
#include <training_algorithm.h>
Classes | |
struct | TrainingAlgorithmResults |
Public Member Functions | |
TrainingAlgorithm (void) | |
TrainingAlgorithm (PerformanceFunctional *) | |
TrainingAlgorithm (const tinyxml2::XMLDocument &) | |
virtual | ~TrainingAlgorithm (void) |
virtual TrainingAlgorithm & | operator= (const TrainingAlgorithm &) |
virtual bool | operator== (const TrainingAlgorithm &) const |
PerformanceFunctional * | get_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 TrainingAlgorithmResults * | perform_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 | |
PerformanceFunctional * | performance_functional_pointer |
size_t | display_period |
size_t | save_period |
std::string | neural_network_file_name |
bool | display |
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.
|
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.
|
explicit |
General constructor. It creates a training algorithm object associated to a performance functional object.
new_performance_functional_pointer | Pointer to a performance functional object. |
Definition at line 40 of file training_algorithm.cpp.
|
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.
|
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.
|
virtual |
Loads a default training algorithm from a XML document.
document | TinyXML 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.
|
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.
file_name | Name of training algorithm XML-type file. |
Definition at line 508 of file training_algorithm.cpp.
|
virtual |
Assignment operator. It assigns to this object the members of an existing training algorithm object.
other_training_algorithm | Training algorithm object to be assigned. |
Definition at line 75 of file training_algorithm.cpp.
|
virtual |
Equal to operator.
other_training_algorithm | Training 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.
file_name | Name 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.
new_performance_functional_pointer | Pointer 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.
new_display | Display 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.
new_display_period | Number 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.
new_neural_network_file_name | File name for the neural network object. |
Definition at line 309 of file training_algorithm.cpp.
|
virtual |
Sets a pointer to a performance functional object to be associated to the training algorithm.
new_performance_functional_pointer | Pointer 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.
new_save_period | Number of iterations between the training saving progress. |
Definition at line 280 of file training_algorithm.cpp.
|
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.
|
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.