IncrementalNeurons Class Reference

This concrete class represents an incremental algorithm for the NeuronsSelection as part of the ModelSelection[1] class. More...

#include <incremental_neurons.h>

Inheritance diagram for IncrementalNeurons:
NeuronsSelection

Classes

struct  IncrementalNeuronsResults
 This structure contains the training results for the incremental order method. More...
 

Public Member Functions

 IncrementalNeurons ()
 Default constructor.
 
 IncrementalNeurons (TrainingStrategy *)
 
 IncrementalNeurons (const tinyxml2::XMLDocument &)
 
 IncrementalNeurons (const string &)
 
virtual ~IncrementalNeurons ()
 Destructor.
 
const size_t & get_step () const
 Returns the number of the hidden perceptrons pointed in each iteration of the Incremental algorithm.
 
const size_t & get_maximum_selection_failures () const
 Returns the maximum number of selection failures in the model order selection algorithm.
 
void set_default ()
 Sets the members of the model selection object to their default values:
 
void set_step (const size_t &)
 
void set_maximum_selection_failures (const size_t &)
 
IncrementalNeuronsResultsperform_neurons_selection ()
 Perform the neurons selection with the Incremental method.
 
Matrix< string > to_string_matrix () const
 Writes as matrix of strings the most representative atributes.
 
tinyxml2::XMLDocumentto_XML () const
 
void from_XML (const tinyxml2::XMLDocument &)
 
void write_XML (tinyxml2::XMLPrinter &) const
 
void save (const string &) const
 
void load (const string &)
 
- Public Member Functions inherited from NeuronsSelection
 NeuronsSelection ()
 Default constructor.
 
 NeuronsSelection (TrainingStrategy *)
 
 NeuronsSelection (const string &)
 
 NeuronsSelection (const tinyxml2::XMLDocument &)
 
virtual ~NeuronsSelection ()
 Destructor.
 
TrainingStrategyget_training_strategy_pointer () const
 Returns a pointer to the training strategy object.
 
bool has_training_strategy () const
 Returns true if this order selection algorithm has a training strategy associated, and false otherwise.
 
const size_t & get_maximum_order () const
 Returns the maximum of the hidden perceptrons number used in the order order selection.
 
const size_t & get_minimum_order () const
 Returns the minimum of the hidden perceptrons number used in the order selection.
 
const size_t & get_trials_number () const
 Returns the number of trials for each network architecture.
 
const bool & get_reserve_error_data () const
 Returns true if the loss index losses are to be reserved, and false otherwise.
 
const bool & get_reserve_selection_error_data () const
 Returns true if the loss index selection losses are to be reserved, and false otherwise.
 
const bool & get_reserve_minimal_parameters () const
 Returns true if the parameters vector of the neural network with minimum selection error is to be reserved, and false otherwise.
 
const bool & get_display () const
 
const double & get_selection_error_goal () const
 Returns the goal for the selection error in the order selection algorithm.
 
const size_t & get_maximum_iterations_number () const
 Returns the maximum number of iterations in the order selection algorithm.
 
const double & get_maximum_time () const
 Returns the maximum time in the order selection algorithm.
 
const double & get_tolerance () const
 Return the tolerance of error for the order selection algorithm.
 
void set_training_strategy_pointer (TrainingStrategy *)
 
void set_default ()
 Sets the members of the order selection object to their default values.
 
void set_maximum_order (const size_t &)
 
void set_minimum_order (const size_t &)
 
void set_trials_number (const size_t &)
 
void set_reserve_error_data (const bool &)
 
void set_reserve_selection_error_data (const bool &)
 
void set_reserve_minimal_parameters (const bool &)
 
void set_display (const bool &)
 
void set_selection_error_goal (const double &)
 
void set_maximum_iterations_number (const size_t &)
 
void set_maximum_time (const double &)
 
void set_tolerance (const double &)
 
Vector< double > calculate_losses (const size_t &, NeuralNetwork &)
 
string write_stopping_condition (const OptimizationAlgorithm::Results &) const
 
void delete_selection_history ()
 Delete the history of the selection error values.
 
void delete_training_loss_history ()
 Delete the history of the loss values.
 
void check () const
 Checks that the different pointers needed for performing the order selection are not nullptr.
 

Private Attributes

size_t step
 Number of neurons added at each iteration.
 
size_t maximum_selection_failures
 Maximum number of iterations at which the selection error increases.
 

Additional Inherited Members

- Public Types inherited from NeuronsSelection
enum  StoppingCondition {
  MaximumTime, SelectionErrorGoal, MaximumIterations, MaximumSelectionFailures,
  AlgorithmFinished
}
 Enumeration of all possibles condition of stop for the algorithms.
 
- Protected Attributes inherited from NeuronsSelection
TrainingStrategytraining_strategy_pointer = nullptr
 Pointer to a training strategy object.
 
Vector< size_t > order_history
 Order of all the neural networks trained.
 
Vector< double > selection_error_history
 Selection loss of all the neural networks trained.
 
Vector< double > training_loss_history
 Performance of all the neural networks trained.
 
Vector< Vector< double > > parameters_history
 
size_t minimum_order
 Minimum number of hidden neurons.
 
size_t maximum_order
 Maximum number of hidden neurons.
 
size_t trials_number
 Number of trials for each neural network.
 
bool reserve_error_data
 True if the loss of all neural networks are to be reserved.
 
bool reserve_selection_error_data
 True if the selection error of all neural networks are to be reserved.
 
bool reserve_minimal_parameters
 True if the vector parameters of the neural network presenting minimum selection error is to be reserved.
 
bool display
 Display messages to screen.
 
double selection_error_goal
 Goal value for the selection error. It is used as a stopping criterion.
 
size_t maximum_iterations_number
 Maximum number of iterations to perform_neurons_selection. It is used as a stopping criterion.
 
double maximum_time
 Maximum selection algorithm time. It is used as a stopping criterion.
 
double tolerance
 Tolerance for the error in the trainings of the algorithm.
 

Detailed Description

This concrete class represents an incremental algorithm for the NeuronsSelection as part of the ModelSelection[1] class.

[1] Neural Designer "Model Selection Algorithms in Predictive Analytics." https://www.neuraldesigner.com/blog/model-selection

Definition at line 37 of file incremental_neurons.h.

Constructor & Destructor Documentation

◆ IncrementalNeurons() [1/3]

IncrementalNeurons ( TrainingStrategy new_training_strategy_pointer)
explicit

Training strategy constructor.

Parameters
new_training_strategy_pointerPointer to a gradient descent object.

Definition at line 26 of file incremental_neurons.cpp.

◆ IncrementalNeurons() [2/3]

IncrementalNeurons ( const tinyxml2::XMLDocument incremental_order_document)
explicit

XML constructor.

Parameters
incremental_order_documentPointer to a TinyXML document containing the incremental order data.

Definition at line 36 of file incremental_neurons.cpp.

◆ IncrementalNeurons() [3/3]

IncrementalNeurons ( const string &  file_name)
explicit

File constructor.

Parameters
file_nameName of XML incremental order file.

Definition at line 46 of file incremental_neurons.cpp.

Member Function Documentation

◆ from_XML()

void from_XML ( const tinyxml2::XMLDocument document)

Deserializes a TinyXML document into this incremental order object.

Parameters
documentTinyXML document containing the member data.

Definition at line 805 of file incremental_neurons.cpp.

◆ load()

void load ( const string &  file_name)

Loads a incremental order object from a XML-type file.

Parameters
file_nameName of incremental order XML-type file.

Definition at line 1104 of file incremental_neurons.cpp.

◆ save()

void save ( const string &  file_name) const

Saves to a XML-type file the members of the incremental order object.

Parameters
file_nameName of incremental order XML-type file.

Definition at line 1091 of file incremental_neurons.cpp.

◆ set_maximum_selection_failures()

void set_maximum_selection_failures ( const size_t &  new_maximum_loss_failures)

Sets the maximum selection failures for the Incremental order selection algorithm.

Parameters
new_maximum_loss_failuresMaximum number of selection failures in the Incremental order selection algorithm.

Definition at line 124 of file incremental_neurons.cpp.

◆ set_step()

void set_step ( const size_t &  new_step)

Sets the number of the hidden perceptrons pointed in each iteration of the Incremental algorithm in the model order selection process.

Parameters
new_stepnumber of hidden perceptrons pointed.

Definition at line 89 of file incremental_neurons.cpp.

◆ to_XML()

tinyxml2::XMLDocument * to_XML ( ) const

Prints to the screen the incremental order parameters, the stopping criteria and other user stuff concerning the incremental order object.

Definition at line 503 of file incremental_neurons.cpp.

◆ write_XML()

void write_XML ( tinyxml2::XMLPrinter file_stream) const

Serializes the incremental order object into a XML document of the TinyXML library without keep the DOM tree in memory. See the OpenNN manual for more information about the format of this document.

Definition at line 681 of file incremental_neurons.cpp.


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