OpenNN
2.2
Open Neural Networks Library
|
#include <training_strategy.h>
Classes | |
struct | Results |
Public Types | |
enum | InitializationType { NO_INITIALIZATION, RANDOM_SEARCH, EVOLUTIONARY_ALGORITHM, USER_INITIALIZATION } |
enum | MainType { NO_MAIN, GRADIENT_DESCENT, CONJUGATE_GRADIENT, QUASI_NEWTON_METHOD, LEVENBERG_MARQUARDT_ALGORITHM, USER_MAIN } |
enum | RefinementType { NO_REFINEMENT, NEWTON_METHOD, USER_REFINEMENT } |
This class represents the concept of training strategy for a neural network. A training strategy is composed of three training algorithms:
Definition at line 58 of file training_strategy.h.
|
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 27 of file training_strategy.cpp.
|
explicit |
Performance functional constructor. It creates a training strategy object associated to a performance functional object. It also constructs the main training algorithm object.
new_performance_functional_pointer | Pointer to a performance functional object. |
Definition at line 52 of file training_strategy.cpp.
|
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 document.
document | Document of the TinyXML library. |
Definition at line 77 of file training_strategy.cpp.
|
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.
file_name | Name of training strategy XML file. |
Definition at line 104 of file training_strategy.cpp.
|
virtual |
Destructor. This destructor deletes the initialization, main and refinement training algorithm objects.
Definition at line 129 of file training_strategy.cpp.
void OpenNN::TrainingStrategy::check_training_algorithms | ( | void | ) | const |
Throws an exception if the training strategy does not have any initialization, main or refinement algorithms.
Definition at line 170 of file training_strategy.cpp.
void OpenNN::TrainingStrategy::from_XML | ( | const tinyxml2::XMLDocument & | document | ) |
Loads the members of this training strategy object from a XML document.
document | XML document of the TinyXML library. |
Definition at line 1784 of file training_strategy.cpp.
ConjugateGradient * OpenNN::TrainingStrategy::get_conjugate_gradient_pointer | ( | void | ) | const |
Returns a pointer to the conjugate gradient main algorithm. It also throws an exception if that pointer is NULL.
Definition at line 338 of file training_strategy.cpp.
const bool & OpenNN::TrainingStrategy::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 674 of file training_strategy.cpp.
EvolutionaryAlgorithm * OpenNN::TrainingStrategy::get_evolutionary_algorithm_pointer | ( | void | ) | const |
Returns a pointer to the evolutionary algorithm initialization algorithm. It also throws an exception if that pointer is NULL.
Definition at line 294 of file training_strategy.cpp.
GradientDescent * OpenNN::TrainingStrategy::get_gradient_descent_pointer | ( | void | ) | const |
Returns a pointer to the gradient descent main algorithm. It also throws an exception if that pointer is NULL.
Definition at line 316 of file training_strategy.cpp.
LevenbergMarquardtAlgorithm * OpenNN::TrainingStrategy::get_Levenberg_Marquardt_algorithm_pointer | ( | void | ) | const |
Returns a pointer to the Levenberg-Marquardt main algorithm. It also throws an exception if that pointer is NULL.
Definition at line 382 of file training_strategy.cpp.
NewtonMethod * OpenNN::TrainingStrategy::get_Newton_method_pointer | ( | void | ) | const |
Returns a pointer to the Newton method refinement algorithm. It also throws an exception if that pointer is NULL.
Definition at line 404 of file training_strategy.cpp.
QuasiNewtonMethod * OpenNN::TrainingStrategy::get_quasi_Newton_method_pointer | ( | void | ) | const |
Returns a pointer to the Newton method main algorithm. It also throws an exception if that pointer is NULL.
Definition at line 360 of file training_strategy.cpp.
RandomSearch * OpenNN::TrainingStrategy::get_random_search_pointer | ( | void | ) | const |
Returns a pointer to the random search initialization algorithm. It also throws an exception if that pointer is NULL.
Definition at line 272 of file training_strategy.cpp.
bool OpenNN::TrainingStrategy::has_performance_functional | ( | void | ) | const |
Returns true if this training strategy has a performance functional associated, and false otherwise.
Definition at line 254 of file training_strategy.cpp.
void OpenNN::TrainingStrategy::initialize_random | ( | void | ) |
Initializes the initialization, main and refinement algorithms at random.
Definition at line 192 of file training_strategy.cpp.
void OpenNN::TrainingStrategy::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 2050 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 1219 of file training_strategy.cpp.
void OpenNN::TrainingStrategy::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 2034 of file training_strategy.cpp.
void OpenNN::TrainingStrategy::set | ( | void | ) |
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 686 of file training_strategy.cpp.
void OpenNN::TrainingStrategy::set | ( | PerformanceFunctional * | new_performance_functional_pointer | ) |
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.
new_performance_functional_pointer | Pointer to a performance functional object. |
Definition at line 705 of file training_strategy.cpp.
|
virtual |
Sets the members of the training strategy object to their default values:
Definition at line 1153 of file training_strategy.cpp.
void OpenNN::TrainingStrategy::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 1140 of file training_strategy.cpp.
void OpenNN::TrainingStrategy::set_initialization_type | ( | const InitializationType & | new_initialization_type | ) |
Sets a new type of initialization training algorithm.
new_initialization_type | Type of initialization training algorithm. |
Definition at line 722 of file training_strategy.cpp.
void OpenNN::TrainingStrategy::set_initialization_type | ( | const std::string & | new_initialization_type | ) |
Sets a new initialization training algorithm from a string.
new_initialization_type | String with the initialization type. |
Definition at line 885 of file training_strategy.cpp.
void OpenNN::TrainingStrategy::set_main_type | ( | const MainType & | new_main_type | ) |
Sets a new type of main training algorithm.
new_main_type | Type of main training algorithm. |
Definition at line 774 of file training_strategy.cpp.
void OpenNN::TrainingStrategy::set_main_type | ( | const std::string & | new_main_type | ) |
Sets a new main training algorithm from a string containing the type.
new_main_type | String with the type of main training algorithm. |
Definition at line 921 of file training_strategy.cpp.
void OpenNN::TrainingStrategy::set_performance_functional_pointer | ( | PerformanceFunctional * | new_performance_functional_pointer | ) |
Sets a pointer to a performance functional object to be associated to the training strategy.
new_performance_functional_pointer | Pointer to a performance functional object. |
Definition at line 998 of file training_strategy.cpp.
void OpenNN::TrainingStrategy::set_refinement_type | ( | const RefinementType & | new_refinement_type | ) |
Sets a new type of refinement algorithm into this training strategy. Note that it destructs the current refinement algorithm object and constructs a new one.
new_refinement_type | Type of refinement training algorithm. |
Definition at line 839 of file training_strategy.cpp.
void OpenNN::TrainingStrategy::set_refinement_type | ( | const std::string & | new_refinement_type | ) |
Sets a new refinement algorithm from a string. It destructs the previous refinement algorithm object and constructs a new object.
new_refinement_type | String with the refinement training algorithm type. |
Definition at line 966 of file training_strategy.cpp.
tinyxml2::XMLDocument * OpenNN::TrainingStrategy::to_XML | ( | void | ) | const |
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 1538 of file training_strategy.cpp.