OpenNN  2.2
Open Neural Networks Library
Classes | Public Types | Public Member Functions | Protected Attributes | List of all members
OpenNN::TrainingRateAlgorithm Class Reference

#include <training_rate_algorithm.h>

Classes

struct  Triplet
 

Public Types

enum  TrainingRateMethod { Fixed, GoldenSection, BrentMethod }
 

Public Member Functions

 TrainingRateAlgorithm (void)
 
 TrainingRateAlgorithm (PerformanceFunctional *)
 
 TrainingRateAlgorithm (const tinyxml2::XMLDocument &)
 
virtual ~TrainingRateAlgorithm (void)
 
PerformanceFunctionalget_performance_functional_pointer (void) const
 
bool has_performance_functional (void) const
 
const TrainingRateMethodget_training_rate_method (void) const
 
std::string write_training_rate_method (void) const
 
const double & get_bracketing_factor (void) const
 
const double & get_training_rate_tolerance (void) const
 
const double & get_warning_training_rate (void) const
 
const double & get_error_training_rate (void) const
 
const bool & get_display (void) const
 
void set (void)
 
void set (PerformanceFunctional *)
 
void set_performance_functional_pointer (PerformanceFunctional *)
 
void set_training_rate_method (const TrainingRateMethod &)
 
void set_training_rate_method (const std::string &)
 
void set_bracketing_factor (const double &)
 
void set_training_rate_tolerance (const double &)
 
void set_warning_training_rate (const double &)
 
void set_error_training_rate (const double &)
 
void set_display (const bool &)
 
virtual void set_default (void)
 
double calculate_golden_section_training_rate (const Triplet &) const
 
double calculate_Brent_method_training_rate (const Triplet &) const
 
Triplet calculate_bracketing_triplet (const double &, const Vector< double > &, const double &) const
 
Vector< double > calculate_fixed_directional_point (const double &, const Vector< double > &, const double &) const
 
Vector< double > calculate_golden_section_directional_point (const double &, const Vector< double > &, const double &) const
 
Vector< double > calculate_Brent_method_directional_point (const double &, const Vector< double > &, const double &) const
 
Vector< double > calculate_directional_point (const double &, const Vector< double > &, const double &) const
 
tinyxml2::XMLDocument * to_XML (void) const
 
void from_XML (const tinyxml2::XMLDocument &)
 

Protected Attributes

PerformanceFunctionalperformance_functional_pointer
 
TrainingRateMethod training_rate_method
 
double bracketing_factor
 
double training_rate_tolerance
 
double warning_training_rate
 
double error_training_rate
 
bool display
 

Detailed Description

This class is used by many different training algorithms to calculate the training rate given a training direction. It implements the golden section method and the Brent's methods.

Definition at line 42 of file training_rate_algorithm.h.

Constructor & Destructor Documentation

OpenNN::TrainingRateAlgorithm::TrainingRateAlgorithm ( void  )
explicit

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

Definition at line 27 of file training_rate_algorithm.cpp.

OpenNN::TrainingRateAlgorithm::TrainingRateAlgorithm ( PerformanceFunctional new_performance_functional_pointer)
explicit

General constructor. It creates a training rate algorithm associated to a performance functional. 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 training_rate_algorithm.cpp.

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

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

Parameters
documentPointer to a TinyXML document->

Definition at line 55 of file training_rate_algorithm.cpp.

Member Function Documentation

TrainingRateAlgorithm::Triplet OpenNN::TrainingRateAlgorithm::calculate_bracketing_triplet ( const double &  performance,
const Vector< double > &  training_direction,
const double &  initial_training_rate 
) const

Returns bracketing triplet. This algorithm is used by line minimization algorithms.

Parameters
performanceInitial performance function performance.
training_directionInitial training direction.
initial_training_rateInitial training rate to start the algorithm.

Definition at line 543 of file training_rate_algorithm.cpp.

Vector< double > OpenNN::TrainingRateAlgorithm::calculate_Brent_method_directional_point ( const double &  performance,
const Vector< double > &  training_direction,
const double &  initial_training_rate 
) const

Returns the training rate by searching in a given direction to locate the minimum of the performance function in that direction. It uses the Brent's method.

Parameters
performanceNeural network performance value.
training_directionTraining direction vector.
initial_training_rateInitial training rate in line minimization.

Definition at line 772 of file training_rate_algorithm.cpp.

double OpenNN::TrainingRateAlgorithm::calculate_Brent_method_training_rate ( const Triplet triplet) const

Returns the minimimal training rate of a parabola defined by three directional points.

Parameters
tripletTriplet containing a minimum.

Definition at line 944 of file training_rate_algorithm.cpp.

Vector< double > OpenNN::TrainingRateAlgorithm::calculate_directional_point ( const double &  performance,
const Vector< double > &  training_direction,
const double &  initial_training_rate 
) const

Returns a vector with two elements: (i) the training rate calculated by means of the corresponding algorithm, and (ii) the performance for that training rate.

Parameters
performanceInitial performance function performance.
training_directionInitial training direction.
initial_training_rateInitial training rate to start the algorithm.

Definition at line 467 of file training_rate_algorithm.cpp.

Vector< double > OpenNN::TrainingRateAlgorithm::calculate_fixed_directional_point ( const double &  ,
const Vector< double > &  training_direction,
const double &  initial_training_rate 
) const

Returns a vector with two elements, a fixed training rate, and the performance for that training rate.

Parameters
training_directionTraining direction for the directional point.
initial_training_rateTraining rate for the directional point.

Definition at line 643 of file training_rate_algorithm.cpp.

Vector< double > OpenNN::TrainingRateAlgorithm::calculate_golden_section_directional_point ( const double &  performance,
const Vector< double > &  training_direction,
const double &  initial_training_rate 
) const

Returns the training rate by searching in a given direction to locate the minimum of the objective function in that direction. It uses the golden section method.

Parameters
performanceNeural multilayer_perceptron_pointer's performance value.
training_directionTraining direction vector.
initial_training_rateInitial training rate in line minimization.

Definition at line 663 of file training_rate_algorithm.cpp.

double OpenNN::TrainingRateAlgorithm::calculate_golden_section_training_rate ( const Triplet triplet) const

Calculates the golden section point within a minimum interval defined by three points.

Parameters
tripletTriplet containing a minimum.

Definition at line 894 of file training_rate_algorithm.cpp.

void OpenNN::TrainingRateAlgorithm::from_XML ( const tinyxml2::XMLDocument &  document)

Loads a training rate algorithm object from a XML-type file. Please mind about the file format, wich is specified in the manual.

Parameters
documentTinyXML document with the training rate algorithm members.

Definition at line 1093 of file training_rate_algorithm.cpp.

const bool & OpenNN::TrainingRateAlgorithm::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 216 of file training_rate_algorithm.cpp.

const double & OpenNN::TrainingRateAlgorithm::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 205 of file training_rate_algorithm.cpp.

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

Returns a pointer to the performance functional object to which the training rate algorithm is associated. If the performance functional pointer is NULL, this method throws an exception.

Definition at line 79 of file training_rate_algorithm.cpp.

const double & OpenNN::TrainingRateAlgorithm::get_warning_training_rate ( void  ) const

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

Definition at line 194 of file training_rate_algorithm.cpp.

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

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

Definition at line 105 of file training_rate_algorithm.cpp.

void OpenNN::TrainingRateAlgorithm::set ( void  )

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

Definition at line 227 of file training_rate_algorithm.cpp.

void OpenNN::TrainingRateAlgorithm::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 240 of file training_rate_algorithm.cpp.

void OpenNN::TrainingRateAlgorithm::set_bracketing_factor ( const double &  new_bracketing_factor)

Sets a new increase factor value to be used for line minimization when bracketing a minimum.

Parameters
new_bracketing_factorBracketing factor value.

Definition at line 332 of file training_rate_algorithm.cpp.

void OpenNN::TrainingRateAlgorithm::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 452 of file training_rate_algorithm.cpp.

void OpenNN::TrainingRateAlgorithm::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 420 of file training_rate_algorithm.cpp.

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

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.

Definition at line 278 of file training_rate_algorithm.cpp.

void OpenNN::TrainingRateAlgorithm::set_training_rate_method ( const TrainingRateMethod new_training_rate_method)

Sets a new training rate method to be used for training.

Parameters
new_training_rate_methodTraining rate method.

Definition at line 289 of file training_rate_algorithm.cpp.

void OpenNN::TrainingRateAlgorithm::set_training_rate_method ( const std::string &  new_training_rate_method)

Sets the method for obtaining the training rate from a string with the name of the method.

Parameters
new_training_rate_methodName of training rate method ("Fixed", "GoldenSection", "BrentMethod" or "UserTrainingRate").

Definition at line 300 of file training_rate_algorithm.cpp.

void OpenNN::TrainingRateAlgorithm::set_training_rate_tolerance ( const double &  new_training_rate_tolerance)

Sets a new tolerance value to be used in line minimization.

Parameters
new_training_rate_toleranceTolerance value in line minimization.

Definition at line 360 of file training_rate_algorithm.cpp.

void OpenNN::TrainingRateAlgorithm::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 391 of file training_rate_algorithm.cpp.

tinyxml2::XMLDocument * OpenNN::TrainingRateAlgorithm::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 999 of file training_rate_algorithm.cpp.


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