OpenNN  2.2
Open Neural Networks Library
Classes | Public Member Functions | Private Attributes | List of all members
OpenNN::RandomSearch Class Reference

#include <random_search.h>

Inheritance diagram for OpenNN::RandomSearch:
OpenNN::TrainingAlgorithm

Classes

struct  RandomSearchResults
 

Public Member Functions

 RandomSearch (void)
 
 RandomSearch (PerformanceFunctional *)
 
 RandomSearch (const tinyxml2::XMLDocument &)
 
virtual ~RandomSearch (void)
 
const double & get_training_rate_reduction_factor (void) const
 
const size_t & get_training_rate_reduction_period (void) const
 
const bool & get_reserve_parameters_history (void) const
 
const bool & get_reserve_parameters_norm_history (void) const
 
const bool & get_reserve_performance_history (void) const
 
const double & get_warning_parameters_norm (void) const
 
const double & get_warning_training_rate (void) const
 
const double & get_error_parameters_norm (void) const
 
const double & get_error_training_rate (void) const
 
const double & get_performance_goal (void) const
 
const size_t & get_maximum_generalization_performance_decreases (void) const
 
const size_t & get_maximum_iterations_number (void) const
 
const double & get_maximum_time (void) const
 
const bool & get_reserve_generalization_performance_history (void) const
 
const bool & get_reserve_training_direction_history (void) const
 
const bool & get_reserve_training_rate_history (void) const
 
const bool & get_reserve_elapsed_time_history (void) const
 
void set_default (void)
 
void set_first_training_rate (const double &)
 
void set_training_rate_reduction_factor (const double &)
 
void set_training_rate_reduction_period (const size_t &)
 
void set_reserve_parameters_history (const bool &)
 
void set_reserve_parameters_norm_history (const bool &)
 
void set_reserve_performance_history (const bool &)
 
void set_warning_parameters_norm (const double &)
 
void set_warning_training_rate (const double &)
 
void set_error_parameters_norm (const double &)
 
void set_error_training_rate (const double &)
 
void set_performance_goal (const double &)
 
void set_maximum_generalization_performance_decreases (const size_t &)
 
void set_maximum_iterations_number (const size_t &)
 
void set_maximum_time (const double &)
 
void set_reserve_generalization_performance_history (const bool &)
 
void set_reserve_training_direction_history (const bool &)
 
void set_reserve_training_direction_norm_history (const bool &)
 
void set_reserve_training_rate_history (const bool &)
 
void set_reserve_elapsed_time_history (const bool &)
 
virtual void set_reserve_all_training_history (const bool &)
 
void set_display_period (const size_t &)
 
Vector< double > calculate_training_direction (void) const
 
RandomSearchResultsperform_training (void)
 
std::string write_training_algorithm_type (void) const
 
Matrix< std::string > to_string_matrix (void) const
 
tinyxml2::XMLDocument * to_XML (void) const
 
void from_XML (const tinyxml2::XMLDocument &)
 
- Public Member Functions inherited from OpenNN::TrainingAlgorithm
 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_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 std::string to_string (void) const
 
void print (void) const
 
void save (const std::string &) const
 
void load (const std::string &)
 
virtual void initialize_random (void)
 

Private Attributes

double first_training_rate
 
double training_rate_reduction_factor
 
size_t training_rate_reduction_period
 
double warning_parameters_norm
 
double warning_training_rate
 
double error_parameters_norm
 
double error_training_rate
 
double performance_goal
 
size_t maximum_generalization_performance_decreases
 
size_t maximum_iterations_number
 
double maximum_time
 
bool reserve_parameters_history
 
bool reserve_parameters_norm_history
 
bool reserve_performance_history
 
bool reserve_generalization_performance_history
 
bool reserve_training_direction_history
 
bool reserve_training_direction_norm_history
 
bool reserve_training_rate_history
 
bool reserve_elapsed_time_history
 

Additional Inherited Members

- Protected Attributes inherited from OpenNN::TrainingAlgorithm
PerformanceFunctionalperformance_functional_pointer
 
size_t display_period
 
size_t save_period
 
std::string neural_network_file_name
 
bool display
 

Detailed Description

This concrete class represents a random search training algorithm for a performance functional of a neural network.

Definition at line 45 of file random_search.h.

Constructor & Destructor Documentation

OpenNN::RandomSearch::RandomSearch ( void  )
explicit

Default constructor. It creates a random search training algorithm not associated to any performance functional object. It also initializes the class members to their default values.

Definition at line 27 of file random_search.cpp.

OpenNN::RandomSearch::RandomSearch ( PerformanceFunctional new_performance_functional_pointer)
explicit

Performance functional constructor. It creates a random search training algorithm associated to a performance functional object. It also initializes the class members to their default values.

Parameters
new_performance_functional_pointerPointer to a performance functional object.

Definition at line 41 of file random_search.cpp.

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

XML constructor. It creates a random search training algorithm not associated to any performance functional object. It also loads the rest of class members from a XML document.

Parameters
documentTinyXML document containing the members of a random search object.

Definition at line 55 of file random_search.cpp.

OpenNN::RandomSearch::~RandomSearch ( void  )
virtual

Destructor. It does not delete any object.

Definition at line 66 of file random_search.cpp.

Member Function Documentation

void OpenNN::RandomSearch::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 from OpenNN::TrainingAlgorithm.

Definition at line 1559 of file random_search.cpp.

const double & OpenNN::RandomSearch::get_error_parameters_norm ( void  ) const

Returns the value for the norm of the parameters vector at wich an error message is written to the screen and the program exits.

Definition at line 97 of file random_search.cpp.

const double & OpenNN::RandomSearch::get_error_training_rate ( void  ) const

Returns the training rate value at wich the line minimization algorithm is assumed to fail when bracketing a minimum.

Definition at line 108 of file random_search.cpp.

const double & OpenNN::RandomSearch::get_performance_goal ( void  ) const

Returns the goal value for the performance. This is used as a stopping criterion when training a multilayer perceptron

Definition at line 119 of file random_search.cpp.

RandomSearch::RandomSearchResults * OpenNN::RandomSearch::perform_training ( void  )
virtual

Trains a neural network with an associated performance functional according to the random search training algorithm. Training occurs according to the training parameters.

Implements OpenNN::TrainingAlgorithm.

Definition at line 898 of file random_search.cpp.

void OpenNN::RandomSearch::set_default ( void  )
virtual

Sets all the random search object members to their default values:

  • Training rate reduction factor: 0.9
  • Training rate reduction period: 10
  • Warning parameters norm: 1.0e6
  • Error parameters norm: 1.0e9
  • Performance goal: -1.0e99
  • Maximum time: 1.0e6
  • Maximum iterations number: 100
  • Reserve potential parameters history: False
  • Reserve potential parameters norm history: False
  • Reserve performance history: False.
  • Display: True
  • Display period: 10

Reimplemented from OpenNN::TrainingAlgorithm.

Definition at line 263 of file random_search.cpp.

void OpenNN::RandomSearch::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 650 of file random_search.cpp.

void OpenNN::RandomSearch::set_error_parameters_norm ( const double &  new_error_parameters_norm)

Sets a new value for the parameters vector norm at which an error message is written to the screen and the program exits.

Parameters
new_error_parameters_normError norm of parameters vector value.

Definition at line 462 of file random_search.cpp.

void OpenNN::RandomSearch::set_error_training_rate ( const double &  new_error_training_rate)

Sets a new training rate value at wich a the line minimization algorithm is assumed to fail when bracketing a minimum.

Parameters
new_error_training_rateError training rate value.

Definition at line 493 of file random_search.cpp.

void OpenNN::RandomSearch::set_first_training_rate ( const double &  new_first_training_rate)

Sets the initial training rate in the random search. The training rate is the step given in some training direction.

Parameters
new_first_training_rateFirs training rate value.

Definition at line 309 of file random_search.cpp.

void OpenNN::RandomSearch::set_maximum_generalization_performance_decreases ( const size_t &  new_maximum_generalization_performance_decreases)

Sets a new maximum number of generalization failures.

Parameters
new_maximum_generalization_performance_decreasesMaximum number of iterations in which the generalization evalutation decreases.

Definition at line 535 of file random_search.cpp.

void OpenNN::RandomSearch::set_maximum_iterations_number ( const size_t &  new_maximum_iterations_number)

Sets a maximum number of iterations for training.

Parameters
new_maximum_iterations_numberMaximum number of iterations for training.

Definition at line 548 of file random_search.cpp.

void OpenNN::RandomSearch::set_maximum_time ( const double &  new_maximum_time)

Sets a new maximum training time.

Parameters
new_maximum_timeMaximum training time.

Definition at line 559 of file random_search.cpp.

void OpenNN::RandomSearch::set_performance_goal ( const double &  new_performance_goal)

Sets a new goal value for the performance. This is used as a stopping criterion when training a multilayer perceptron

Parameters
new_performance_goalGoal value for the performance.

Definition at line 524 of file random_search.cpp.

void OpenNN::RandomSearch::set_reserve_all_training_history ( const bool &  new_reserve_all_training_history)
virtual

Makes the training history of all variables to be reseved or not in memory.

Makes the training history of all variables to reseved or not in memory.

Parameters
new_reserve_all_training_historyTrue if the training history of all variables is to be reserved, false otherwise.

Definition at line 378 of file random_search.cpp.

void OpenNN::RandomSearch::set_reserve_elapsed_time_history ( const bool &  new_reserve_elapsed_time_history)

Makes the elapsed time over the iterations to be reseved or not in memory. This is a vector.

Parameters
new_reserve_elapsed_time_historyTrue if the elapsed time history vector is to be reserved, false otherwise.

Definition at line 626 of file random_search.cpp.

void OpenNN::RandomSearch::set_reserve_generalization_performance_history ( const bool &  new_reserve_generalization_performance_history)

Makes the Generalization performance history to be reserved or not in memory. This is a vector.

Parameters
new_reserve_generalization_performance_historyTrue if the Generalization performance history is to be reserved, false otherwise.

Definition at line 638 of file random_search.cpp.

void OpenNN::RandomSearch::set_reserve_parameters_history ( const bool &  new_reserve_parameters_history)

Makes the potential parameters history vector of vectors to be reseved or not in memory.

Parameters
new_reserve_parameters_historyTrue if the potential parameters history is to be reserved, false otherwise.

Definition at line 342 of file random_search.cpp.

void OpenNN::RandomSearch::set_reserve_parameters_norm_history ( const bool &  new_reserve_parameters_norm_history)

Makes the potential parameters norm history vector to be reseved or not in memory.

Parameters
new_reserve_parameters_norm_historyTrue if the potential parameters norm history is to be reserved, false otherwise.

Definition at line 354 of file random_search.cpp.

void OpenNN::RandomSearch::set_reserve_performance_history ( const bool &  new_reserve_performance_history)

Makes the potential performance history vector to be reseved or not in memory.

Parameters
new_reserve_performance_historyTrue if the potential performance history is to be reserved, false otherwise.

Definition at line 366 of file random_search.cpp.

void OpenNN::RandomSearch::set_reserve_training_direction_history ( const bool &  new_reserve_training_direction_history)

Makes the training direction history vector of vectors to be reseved or not in memory.

Parameters
new_reserve_training_direction_historyTrue if the training direction history matrix is to be reserved, false otherwise.

Definition at line 590 of file random_search.cpp.

void OpenNN::RandomSearch::set_reserve_training_direction_norm_history ( const bool &  new_reserve_training_direction_norm_history)

Makes the training direction norm history vector to be reseved or not in memory.

Parameters
new_reserve_training_direction_norm_historyTrue if the history of the norm of the training direction is to be reserved, false otherwise.

Definition at line 602 of file random_search.cpp.

void OpenNN::RandomSearch::set_reserve_training_rate_history ( const bool &  new_reserve_training_rate_history)

Makes the training rate history vector to be reseved or not in memory.

Parameters
new_reserve_training_rate_historyTrue if the training rate history vector is to be reserved, false otherwise.

Definition at line 614 of file random_search.cpp.

void OpenNN::RandomSearch::set_training_rate_reduction_factor ( const double &  new_training_rate_reduction_factor)

Sets a new value for the reduction factor of the training rate.

Parameters
new_training_rate_reduction_factorReduction factor value.

Definition at line 320 of file random_search.cpp.

void OpenNN::RandomSearch::set_training_rate_reduction_period ( const size_t &  new_training_rate_reduction_period)

Sets a new period value for the reduction of the training rate. This is measured in training iterations.

Parameters
new_training_rate_reduction_periodReduction period for the training rate.

Definition at line 331 of file random_search.cpp.

void OpenNN::RandomSearch::set_warning_parameters_norm ( const double &  new_warning_parameters_norm)

Sets a new value for the parameters vector norm at which a warning message is written to the screen.

Parameters
new_warning_parameters_normWarning norm of parameters vector value.

Definition at line 401 of file random_search.cpp.

void OpenNN::RandomSearch::set_warning_training_rate ( const double &  new_warning_training_rate)

Sets a new training rate value at wich a warning message is written to the screen during line minimization.

Parameters
new_warning_training_rateWarning training rate value.

Definition at line 433 of file random_search.cpp.

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

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

Reimplemented from OpenNN::TrainingAlgorithm.

Definition at line 1174 of file random_search.cpp.

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

Prints to the screen the training parameters, the stopping criteria and other user stuff concerning the random search object.

Reimplemented from OpenNN::TrainingAlgorithm.

Definition at line 1286 of file random_search.cpp.

Member Data Documentation

size_t OpenNN::RandomSearch::maximum_generalization_performance_decreases
private

Maximum number of iterations at which the generalization performance decreases. This is an early stopping method for improving generalization.

Definition at line 322 of file random_search.h.

double OpenNN::RandomSearch::training_rate_reduction_factor
private

Factor which reduces the training rate. It must be greater than zero and less than one.

Definition at line 290 of file random_search.h.


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