9#ifndef NEURONSSELECTION_H
10#define NEURONSSELECTION_H
24#include "training_strategy.h"
29struct NeuronsSelectionResults;
56 enum class StoppingCondition{MaximumTime, SelectionErrorGoal, MaximumEpochs, MaximumSelectionFailures, MaximumNeurons};
185 void resize_history(
const Index& new_size)
195 for(Index i = 0; i < new_size; i++)
208 cout <<
"Neurons Selection Results" << endl;
This abstract class represents the concept of neurons selection algorithm for a ModelSelection[1].
Tensor< type, 1 > selection_error_history
Selection loss of all the neural networks trained.
Index minimum_neurons
Minimum number of hidden neurons.
void set_training_strategy_pointer(TrainingStrategy *)
NeuronsSelection()
Default constructor.
const type & get_maximum_time() const
Returns the maximum time in the neurons selection algorithm.
TrainingStrategy * training_strategy_pointer
Pointer to a training strategy object.
const bool & get_display() const
void set_selection_error_goal(const type &)
void set_default()
Sets the members of the neurons selection object to their default values.
Index maximum_neurons
Maximum number of hidden neurons.
void delete_training_error_history()
Delete the history of the loss values.
virtual ~NeuronsSelection()
Destructor.
void check() const
Checks that the different pointers needed for performing the neurons selection are not nullptr.
const Index & get_minimum_neurons() const
Returns the minimum of the hidden perceptrons number used in the neurons selection.
Index trials_number
Number of trials for each neural network.
const Index & get_maximum_epochs_number() const
Returns the maximum number of epochs in the neurons selection algorithm.
bool display
Display messages to screen.
Tensor< Index, 1 > neurons_history
Neurons of all the neural networks trained.
type selection_error_goal
Goal value for the selection error. It is used as a stopping criterion.
void set_maximum_time(const type &)
const string write_time(const type &) const
Writes the time from seconds in format HH:mm:ss.
const Index & get_trials_number() const
Returns the number of trials for each network architecture.
type maximum_time
Maximum selection algorithm time. It is used as a stopping criterion.
void set_maximum_epochs_number(const Index &)
const type & get_selection_error_goal() const
Returns the goal for the selection error in the neurons selection algorithm.
virtual NeuronsSelectionResults perform_neurons_selection()=0
Performs the neurons selection for a neural network.
void set_maximum_neurons_number(const Index &)
TrainingStrategy * get_training_strategy_pointer() const
Returns a pointer to the training strategy object.
const Index & get_maximum_neurons() const
Returns the maximum of the hidden perceptrons number used in the neurons selection.
Tensor< type, 1 > training_error_history
Error of all the neural networks trained.
void set_minimum_neurons(const Index &)
Index maximum_epochs_number
Maximum number of epochs to perform neurons selection. It is used as a stopping criterion.
void set_display(const bool &)
StoppingCondition
Enumeration of all possibles condition of stop for the algorithms.
string write_stopping_condition(const TrainingResults &) const
bool has_training_strategy() const
Returns true if this neurons selection algorithm has a training strategy associated,...
void set_trials_number(const Index &)
void delete_selection_history()
Delete the history of the selection error values.
This class represents the concept of training strategy for a neural network in OpenNN.
This structure contains the results from the neurons selection.
type optimum_training_error
Value of loss for the neural network with minimum selection error.
Tensor< type, 1 > selection_error_history
Selection loss of the different neural networks.
Index optimal_neurons_number
Neurons of the neural network with minimum selection error.
Tensor< type, 1 > optimal_parameters
Vector of parameters for the neural network with minimum selection error.
type optimum_selection_error
Value of minimum selection error.
Tensor< type, 1 > training_error_history
Performance of the different neural networks.
NeuronsSelection::StoppingCondition stopping_condition
Stopping condition of the algorithm.
string elapsed_time
Elapsed time during the loss of the algortihm.
Tensor< Index, 1 > neurons_number_history
Neurons of the diferent neural networks.
string write_stopping_condition() const
Return a string with the stopping condition of the Results.
This structure contains the optimization algorithm results.