OpenNN
2.2
Open Neural Networks Library
|
#include <newton_method.h>
Classes | |
struct | NewtonMethodResults |
Private Attributes | |
TrainingRateAlgorithm | training_rate_algorithm |
double | warning_parameters_norm |
double | warning_gradient_norm |
double | warning_training_rate |
double | error_parameters_norm |
double | error_gradient_norm |
double | error_training_rate |
double | minimum_parameters_increment_norm |
double | minimum_performance_increase |
double | performance_goal |
double | gradient_norm_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_gradient_history |
bool | reserve_gradient_norm_history |
bool | reserve_inverse_Hessian_history |
bool | reserve_training_direction_history |
bool | reserve_training_rate_history |
bool | reserve_elapsed_time_history |
bool | reserve_generalization_performance_history |
Additional Inherited Members | |
Protected Attributes inherited from OpenNN::TrainingAlgorithm | |
PerformanceFunctional * | performance_functional_pointer |
size_t | display_period |
size_t | save_period |
std::string | neural_network_file_name |
bool | display |
This concrete class represents the Newton method training algorithm for a performance functional of a neural network.
Definition at line 45 of file newton_method.h.
|
explicit |
Default constructor. It creates a Newton method training 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 newton_method.cpp.
|
explicit |
General constructor. It creates a Newton method training algorithm object associated to a performance functional object. It also initializes the class members to their default values.
new_performance_functional_pointer | Pointer to a performance functional object. |
Definition at line 41 of file newton_method.cpp.
|
explicit |
XML Constructor. Creates a Newton method object, and loads its members from a XML document.
document | Pointer to a TinyXML document containing the Newton method data. |
Definition at line 56 of file newton_method.cpp.
Vector< double > OpenNN::NewtonMethod::calculate_gradient_descent_training_direction | ( | const Vector< double > & | gradient | ) | const |
Returns the gradient descent training direction, which is the negative of the normalized gradient.
gradient | Gradient vector. |
Definition at line 886 of file newton_method.cpp.
Vector< double > OpenNN::NewtonMethod::calculate_training_direction | ( | const Vector< double > & | gradient, |
const Matrix< double > & | inverse_Hessian | ||
) | const |
Returns the Newton method training direction, which has been previously normalized.
gradient | Gradient vector. |
inverse_Hessian | Inverse Hessian matrix. |
Definition at line 931 of file newton_method.cpp.
|
virtual |
Loads a default training algorithm from a XML document.
document | TinyXML document containing the performance term members. |
Reimplemented from OpenNN::TrainingAlgorithm.
Definition at line 2134 of file newton_method.cpp.
const double & OpenNN::NewtonMethod::get_error_gradient_norm | ( | void | ) | const |
Returns the value for the norm of the gradient vector at wich an error message is written to the screen and the program exits.
Definition at line 145 of file newton_method.cpp.
const double & OpenNN::NewtonMethod::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 134 of file newton_method.cpp.
const double & OpenNN::NewtonMethod::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 156 of file newton_method.cpp.
const double & OpenNN::NewtonMethod::get_gradient_norm_goal | ( | void | ) | const |
Returns the goal value for the norm of the objective function gradient. This is used as a stopping criterion when training a multilayer perceptron
Definition at line 198 of file newton_method.cpp.
const double & OpenNN::NewtonMethod::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 187 of file newton_method.cpp.
const double & OpenNN::NewtonMethod::get_warning_gradient_norm | ( | void | ) | const |
Returns the minimum value for the norm of the gradient vector at wich a warning message is written to the screen.
Definition at line 112 of file newton_method.cpp.
const double & OpenNN::NewtonMethod::get_warning_parameters_norm | ( | void | ) | const |
Returns the minimum value for the norm of the parameters vector at wich a warning message is written to the screen.
Definition at line 101 of file newton_method.cpp.
const double & OpenNN::NewtonMethod::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 123 of file newton_method.cpp.
|
virtual |
Trains a neural network with an associated performance functional according to the Newton method algorithm. Training occurs according to the training operators, the training parameters and the stopping criteria.
Implements OpenNN::TrainingAlgorithm.
Definition at line 1212 of file newton_method.cpp.
void OpenNN::NewtonMethod::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 857 of file newton_method.cpp.
void OpenNN::NewtonMethod::set_error_gradient_norm | ( | const double & | new_error_gradient_norm | ) |
Sets a new value for the gradient vector norm at which an error message is written to the screen and the program exits.
new_error_gradient_norm | Error norm of gradient vector value. |
Definition at line 524 of file newton_method.cpp.
void OpenNN::NewtonMethod::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.
new_error_parameters_norm | Error norm of parameters vector value. |
Definition at line 493 of file newton_method.cpp.
void OpenNN::NewtonMethod::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.
new_error_training_rate | Error training rate value. |
Definition at line 555 of file newton_method.cpp.
void OpenNN::NewtonMethod::set_gradient_norm_goal | ( | const double & | new_gradient_norm_goal | ) |
Sets a new the goal value for the norm of the objective function gradient. This is used as a stopping criterion when training a multilayer perceptron
new_gradient_norm_goal | Goal value for the norm of the objective function gradient. |
Definition at line 658 of file newton_method.cpp.
void OpenNN::NewtonMethod::set_maximum_generalization_performance_decreases | ( | const size_t & | new_maximum_generalization_performance_decreases | ) |
Sets a new maximum number of generalization failures.
new_maximum_generalization_performance_decreases | Maximum number of iterations in which the generalization evalutation decreases. |
Definition at line 688 of file newton_method.cpp.
void OpenNN::NewtonMethod::set_maximum_iterations_number | ( | const size_t & | new_maximum_iterations_number | ) |
Sets a maximum number of iterations for training.
new_maximum_iterations_number | Maximum number of iterations for training. |
Definition at line 699 of file newton_method.cpp.
void OpenNN::NewtonMethod::set_maximum_time | ( | const double & | new_maximum_time | ) |
Sets a new maximum training time.
new_maximum_time | Maximum training time. |
Definition at line 710 of file newton_method.cpp.
void OpenNN::NewtonMethod::set_minimum_parameters_increment_norm | ( | const double & | new_minimum_parameters_increment_norm | ) |
Sets a new value for the minimum parameters increment norm stopping criterion.
new_minimum_parameters_increment_norm | Value of norm of parameters increment norm used to stop training. |
Definition at line 585 of file newton_method.cpp.
void OpenNN::NewtonMethod::set_minimum_performance_increase | ( | const double & | new_minimum_performance_increase | ) |
Sets a new minimum performance improvement during training.
new_minimum_performance_increase | Minimum improvement in the performance between two iterations. |
Definition at line 615 of file newton_method.cpp.
|
virtual |
Sets a pointer to a performance functional object to be associated to the Newton method object. It also sets that performance functional to the training rate algorithm.
new_performance_functional_pointer | Pointer to a performance functional object. |
Reimplemented from OpenNN::TrainingAlgorithm.
Definition at line 340 of file newton_method.cpp.
void OpenNN::NewtonMethod::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
new_performance_goal | Goal value for the performance. |
Definition at line 646 of file newton_method.cpp.
void OpenNN::NewtonMethod::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.
new_reserve_elapsed_time_history | True if the elapsed time history vector is to be reserved, false otherwise. |
Definition at line 833 of file newton_method.cpp.
void OpenNN::NewtonMethod::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.
new_reserve_generalization_performance_history | True if the Generalization performance history is to be reserved, false otherwise. |
Definition at line 845 of file newton_method.cpp.
void OpenNN::NewtonMethod::set_reserve_gradient_history | ( | const bool & | new_reserve_gradient_history | ) |
Makes the gradient history vector of vectors to be reseved or not in memory.
new_reserve_gradient_history | True if the gradient history matrix is to be reserved, false otherwise. |
Definition at line 773 of file newton_method.cpp.
void OpenNN::NewtonMethod::set_reserve_gradient_norm_history | ( | const bool & | new_reserve_gradient_norm_history | ) |
Makes the gradient norm history vector to be reseved or not in memory.
new_reserve_gradient_norm_history | True if the gradient norm history matrix is to be reserved, false otherwise. |
Definition at line 785 of file newton_method.cpp.
void OpenNN::NewtonMethod::set_reserve_inverse_Hessian_history | ( | const bool & | new_reserve_inverse_Hessian_history | ) |
Sets the history of the inverse of the Hessian matrix to be reserved or not in memory. This is a vector of matrices.
new_reserve_inverse_Hessian_history | True if the inverse Hessian history is to be reserved, false otherwise. |
Definition at line 797 of file newton_method.cpp.
void OpenNN::NewtonMethod::set_reserve_parameters_history | ( | const bool & | new_reserve_parameters_history | ) |
Makes the parameters history vector of vectors to be reseved or not in memory.
new_reserve_parameters_history | True if the parameters history vector of vectors is to be reserved, false otherwise. |
Definition at line 740 of file newton_method.cpp.
void OpenNN::NewtonMethod::set_reserve_parameters_norm_history | ( | const bool & | new_reserve_parameters_norm_history | ) |
Makes the parameters norm history vector to be reseved or not in memory.
new_reserve_parameters_norm_history | True if the parameters norm history vector is to be reserved, false otherwise. |
Definition at line 751 of file newton_method.cpp.
void OpenNN::NewtonMethod::set_reserve_performance_history | ( | const bool & | new_reserve_performance_history | ) |
Makes the performance history vector to be reseved or not in memory.
new_reserve_performance_history | True if the performance history vector is to be reserved, false otherwise. |
Definition at line 762 of file newton_method.cpp.
void OpenNN::NewtonMethod::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.
new_reserve_training_direction_history | True if the training direction history matrix is to be reserved, false otherwise. |
Definition at line 809 of file newton_method.cpp.
void OpenNN::NewtonMethod::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.
new_reserve_training_rate_history | True if the training rate history vector is to be reserved, false otherwise. |
Definition at line 821 of file newton_method.cpp.
void OpenNN::NewtonMethod::set_warning_gradient_norm | ( | const double & | new_warning_gradient_norm | ) |
Sets a new value for the gradient vector norm at which a warning message is written to the screen.
new_warning_gradient_norm | Warning norm of gradient vector value. |
Definition at line 433 of file newton_method.cpp.
void OpenNN::NewtonMethod::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.
new_warning_parameters_norm | Warning norm of parameters vector value. |
Definition at line 402 of file newton_method.cpp.
void OpenNN::NewtonMethod::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.
new_warning_training_rate | Warning training rate value. |
Definition at line 464 of file newton_method.cpp.
|
virtual |
Returns a default (empty) string matrix containing the members of the training algorithm object.
Reimplemented from OpenNN::TrainingAlgorithm.
Definition at line 1601 of file newton_method.cpp.
|
virtual |
Prints to the screen the training parameters, the stopping criteria and other user stuff concerning the Newton's method object: Stopping criteria:
User stuff:
Reimplemented from OpenNN::TrainingAlgorithm.
Definition at line 1778 of file newton_method.cpp.
|
private |
Maximum number of iterations at which the generalization performance decreases. This is an early stopping method for improving generalization.
Definition at line 353 of file newton_method.h.
|
private |
Training rate algorithm object. It is used to calculate the step for the Newton training direction.
Definition at line 305 of file newton_method.h.