9#ifndef CONJUGATEGRADIENT_H
10#define CONJUGATEGRADIENT_H
27#include "loss_index.h"
28#include "optimization_algorithm.h"
29#include "learning_rate_algorithm.h"
34struct ConjugateGradientData;
121 void calculate_gradient_descent_training_direction(
const Tensor<type, 1>&, Tensor<type, 1>&)
const;
124 const Tensor<type, 1>&,
125 const Tensor<type, 1>&,
126 Tensor<type, 1>&)
const;
150 type first_learning_rate =
static_cast<type
>(0.01);
201 Tensor<type, 1> parameters_increment;
203 Tensor<type, 1> old_gradient;
205 Tensor<type, 1> old_training_direction;
209 type learning_rate = type(0);
210 type old_learning_rate = type(0);
212 Tensor<type, 0> training_slope;
TrainingResults perform_training()
void set_maximum_selection_failures(const Index &)
void calculate_FR_training_direction(const Tensor< type, 1 > &, const Tensor< type, 1 > &, const Tensor< type, 1 > &, Tensor< type, 1 > &) const
void set_loss_index_pointer(LossIndex *)
const type & get_maximum_time() const
Returns the maximum training time.
const type & get_loss_goal() const
void from_XML(const tinyxml2::XMLDocument &)
const Index & get_maximum_epochs_number() const
Returns the maximum number of epochs for training.
Tensor< string, 2 > to_string_matrix() const
Writes as matrix of strings the most representative atributes.
type minimum_loss_decrease
Minimum loss improvement between two successive iterations. It is used as a stopping criterion.
LearningRateAlgorithm * get_learning_rate_algorithm_pointer()
Returns a pointer to the learning rate algorithm object inside the conjugate gradient method object.
void calculate_conjugate_gradient_training_direction(const Tensor< type, 1 > &, const Tensor< type, 1 > &, const Tensor< type, 1 > &, Tensor< type, 1 > &) const
string write_optimization_algorithm_type() const
Write a string with best algorithm type for the model.
const LearningRateAlgorithm & get_learning_rate_algorithm() const
Returns a constant reference to the learning rate algorithm object inside the conjugate gradient meth...
void set_save_period(const Index &)
void set_maximum_time(const type &)
LearningRateAlgorithm learning_rate_algorithm
Learning rate algorithm object for one-dimensional minimization.
void set_loss_goal(const type &)
type calculate_PR_parameter(const Tensor< type, 1 > &, const Tensor< type, 1 > &) const
void set_training_direction_method(const TrainingDirectionMethod &)
type maximum_time
Maximum training time. It is used as a stopping criterion.
void set_maximum_epochs_number(const Index &)
void set_minimum_loss_decrease(const type &)
TrainingDirectionMethod
Enumeration of the available training operators for obtaining the training direction.
virtual ~ConjugateGradient()
Destructor.
type calculate_FR_parameter(const Tensor< type, 1 > &, const Tensor< type, 1 > &) const
type training_loss_goal
Goal value for the loss. It is used as a stopping criterion.
Index maximum_epochs_number
Maximum number of epochs to perform_training. It is used as a stopping criterion.
void write_XML(tinyxml2::XMLPrinter &) const
const Index & get_maximum_selection_failures() const
Returns the maximum number of selection error increases during the training process.
Index maximum_selection_failures
void calculate_PR_training_direction(const Tensor< type, 1 > &, const Tensor< type, 1 > &, const Tensor< type, 1 > &, Tensor< type, 1 > &) const
string write_training_direction_method() const
Returns a string with the name of the training direction.
TrainingDirectionMethod training_direction_method
Applied method for calculating the conjugate gradient direction.
void update_parameters(const DataSetBatch &batch, NeuralNetworkForwardPropagation &forward_propagation, LossIndexBackPropagation &back_propagation, ConjugateGradientData &optimization_data)
ConjugateGradient::update_parameters.
const TrainingDirectionMethod & get_training_direction_method() const
Returns the conjugate gradient training direction method used for training.
const type & get_minimum_loss_decrease() const
Returns the minimum loss improvement during training.
A learning rate that is adjusted according to an algorithm during training to minimize training time.
This abstract class represents the concept of loss index composed of an error term and a regularizati...
ConjugateGradientData()
Default constructor.
This structure contains the optimization algorithm results.