ModelSelection Class Reference

This class represents the concept of model selection[1] algorithm in OpenNN. More...

#include <model_selection.h>

Public Types

enum class  NeuronsSelectionMethod { GROWING_NEURONS }
 Enumeration of all the available neurons selection algorithms. More...
 
enum class  InputsSelectionMethod { GROWING_INPUTS , PRUNING_INPUTS , GENETIC_ALGORITHM }
 Enumeration of all the available inputs selection algorithms. More...
 

Public Member Functions

 ModelSelection ()
 Default constructor. More...
 
 ModelSelection (TrainingStrategy *)
 
virtual ~ModelSelection ()
 Destructor. More...
 
TrainingStrategyget_training_strategy_pointer () const
 Returns a pointer to the training strategy object. More...
 
bool has_training_strategy () const
 
const NeuronsSelectionMethodget_neurons_selection_method () const
 Returns the type of algorithm for the neurons selection. More...
 
const InputsSelectionMethodget_inputs_selection_method () const
 Returns the type of algorithm for the inputs selection. More...
 
GrowingNeuronsget_growing_neurons_pointer ()
 Returns a pointer to the growing neurons selection algorithm. More...
 
GrowingInputsget_growing_inputs_pointer ()
 Returns a pointer to the growing inputs selection algorithm. More...
 
PruningInputsget_pruning_inputs_pointer ()
 Returns a pointer to the pruning inputs selection algorithm. More...
 
GeneticAlgorithmget_genetic_algorithm_pointer ()
 Returns a pointer to the genetic inputs selection algorithm. More...
 
void set (TrainingStrategy *)
 
void set_default ()
 Sets the members of the model selection object to their default values. More...
 
void set_display (const bool &)
 
void set_neurons_selection_method (const NeuronsSelectionMethod &)
 
void set_neurons_selection_method (const string &)
 
void set_inputs_selection_method (const InputsSelectionMethod &)
 
void set_inputs_selection_method (const string &)
 
void check () const
 Checks that the different pointers needed for performing the model selection are not nullptr. More...
 
NeuronsSelectionResults perform_neurons_selection ()
 
InputsSelectionResults perform_inputs_selection ()
 
void from_XML (const tinyxml2::XMLDocument &)
 
void write_XML (tinyxml2::XMLPrinter &) const
 
string write_neurons_selection_method () const
 
string write_inputs_selection_method () const
 
void print () const
 Prints to the screen the XML representation of this model selection object. More...
 
void save (const string &) const
 
void load (const string &)
 

Private Attributes

TrainingStrategytraining_strategy_pointer = nullptr
 Pointer to a training strategy object. More...
 
GrowingNeurons growing_neurons
 Growing neurons object to be used for neurons selection. More...
 
GrowingInputs growing_inputs
 Growing inputs object to be used for inputs selection. More...
 
PruningInputs pruning_inputs
 Pruning inputs object to be used for inputs selection. More...
 
GeneticAlgorithm genetic_algorithm
 Genetic algorithm object to be used for inputs selection. More...
 
NeuronsSelectionMethod neurons_selection_method
 Type of neurons selection algorithm. More...
 
InputsSelectionMethod inputs_selection_method
 Type of inputs selection algorithm. More...
 
bool display = true
 Display messages to screen. More...
 

Detailed Description

This class represents the concept of model selection[1] algorithm in OpenNN.

It is used for finding a network architecture with maximum generalization capabilities.

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

Definition at line 40 of file model_selection.h.

Member Enumeration Documentation

◆ InputsSelectionMethod

enum class InputsSelectionMethod
strong

Enumeration of all the available inputs selection algorithms.

Definition at line 61 of file model_selection.h.

◆ NeuronsSelectionMethod

enum class NeuronsSelectionMethod
strong

Enumeration of all the available neurons selection algorithms.

Definition at line 57 of file model_selection.h.

Constructor & Destructor Documentation

◆ ModelSelection() [1/2]

ModelSelection ( )
explicit

Default constructor.

Definition at line 16 of file model_selection.cpp.

◆ ModelSelection() [2/2]

ModelSelection ( TrainingStrategy new_training_strategy_pointer)
explicit

Training strategy constructor.

Parameters
new_training_strategy_pointerPointer to a training strategy object.

Definition at line 25 of file model_selection.cpp.

◆ ~ModelSelection()

~ModelSelection ( )
virtual

Destructor.

Definition at line 35 of file model_selection.cpp.

Member Function Documentation

◆ check()

void check ( ) const

Checks that the different pointers needed for performing the model selection are not nullptr.

Definition at line 254 of file model_selection.cpp.

◆ from_XML()

void from_XML ( const tinyxml2::XMLDocument document)

Loads the members of this model selection object from a XML document.

Parameters
documentXML document of the TinyXML library.

Definition at line 412 of file model_selection.cpp.

◆ get_genetic_algorithm_pointer()

GeneticAlgorithm * get_genetic_algorithm_pointer ( )

Returns a pointer to the genetic inputs selection algorithm.

Definition at line 121 of file model_selection.cpp.

◆ get_growing_inputs_pointer()

GrowingInputs * get_growing_inputs_pointer ( )

Returns a pointer to the growing inputs selection algorithm.

Definition at line 105 of file model_selection.cpp.

◆ get_growing_neurons_pointer()

GrowingNeurons * get_growing_neurons_pointer ( )

Returns a pointer to the growing neurons selection algorithm.

Definition at line 97 of file model_selection.cpp.

◆ get_inputs_selection_method()

const ModelSelection::InputsSelectionMethod & get_inputs_selection_method ( ) const

Returns the type of algorithm for the inputs selection.

Definition at line 89 of file model_selection.cpp.

◆ get_neurons_selection_method()

const ModelSelection::NeuronsSelectionMethod & get_neurons_selection_method ( ) const

Returns the type of algorithm for the neurons selection.

Definition at line 81 of file model_selection.cpp.

◆ get_pruning_inputs_pointer()

PruningInputs * get_pruning_inputs_pointer ( )

Returns a pointer to the pruning inputs selection algorithm.

Definition at line 113 of file model_selection.cpp.

◆ get_training_strategy_pointer()

TrainingStrategy * get_training_strategy_pointer ( ) const

Returns a pointer to the training strategy object.

Definition at line 42 of file model_selection.cpp.

◆ has_training_strategy()

bool has_training_strategy ( ) const

Returns true if this model selection has a training strategy associated, and false otherwise.

Definition at line 66 of file model_selection.cpp.

◆ load()

void load ( const string &  file_name)

Loads the model selection members from a XML file.

Parameters
file_nameName of model selection XML file.

Definition at line 595 of file model_selection.cpp.

◆ perform_inputs_selection()

InputsSelectionResults perform_inputs_selection ( )

Perform the inputs selection, returns a structure with the results of the inputs selection. It also set the neural network of the training strategy pointer with the optimum parameters.

Definition at line 350 of file model_selection.cpp.

◆ perform_neurons_selection()

NeuronsSelectionResults perform_neurons_selection ( )

Perform the neurons selection, returns a structure with the results of the neurons selection. It also set the neural network of the training strategy pointer with the optimum parameters.

Todo:

Definition at line 335 of file model_selection.cpp.

◆ print()

void print ( ) const

Prints to the screen the XML representation of this model selection object.

Definition at line 571 of file model_selection.cpp.

◆ save()

void save ( const string &  file_name) const

Saves the model selection members to a XML file.

Parameters
file_nameName of model selection XML file.

Definition at line 580 of file model_selection.cpp.

◆ set()

void set ( TrainingStrategy new_training_strategy_pointer)

Sets a new training strategy pointer.

Parameters
new_training_strategy_pointerPointer to a training strategy object.

Definition at line 236 of file model_selection.cpp.

◆ set_default()

void set_default ( )

Sets the members of the model selection object to their default values.

Definition at line 129 of file model_selection.cpp.

◆ set_display()

void 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 144 of file model_selection.cpp.

◆ set_inputs_selection_method() [1/2]

void set_inputs_selection_method ( const InputsSelectionMethod new_inputs_selection_method)

Sets a new method for selecting the inputs which have more impact on the targets.

Parameters
new_inputs_selection_methodMethod for selecting the inputs(GROWING_INPUTS, PRUNING_INPUTS, GENETIC_ALGORITHM).

Definition at line 197 of file model_selection.cpp.

◆ set_inputs_selection_method() [2/2]

void set_inputs_selection_method ( const string &  new_inputs_selection_method)

Sets a new inputs selection algorithm from a string.

Parameters
new_inputs_selection_methodString with the inputs selection type.

Definition at line 206 of file model_selection.cpp.

◆ set_neurons_selection_method() [1/2]

void set_neurons_selection_method ( const NeuronsSelectionMethod new_neurons_selection_method)

Sets a new method for selecting the order which have more impact on the targets.

Parameters
new_neurons_selection_methodMethod for selecting the order(NO_NEURONS_SELECTION, growing_neurons, GOLDEN_SECTION, SIMULATED_ANNEALING).

Definition at line 166 of file model_selection.cpp.

◆ set_neurons_selection_method() [2/2]

void set_neurons_selection_method ( const string &  new_neurons_selection_method)

Sets a new neurons selection algorithm from a string.

Parameters
new_neurons_selection_methodString with the neurons selection type.

Definition at line 175 of file model_selection.cpp.

◆ write_inputs_selection_method()

string write_inputs_selection_method ( ) const

Definition at line 551 of file model_selection.cpp.

◆ write_neurons_selection_method()

string write_neurons_selection_method ( ) const

Definition at line 539 of file model_selection.cpp.

◆ write_XML()

void write_XML ( tinyxml2::XMLPrinter file_stream) const

Serializes the model selection 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 371 of file model_selection.cpp.

Member Data Documentation

◆ display

bool display = true
private

Display messages to screen.

Definition at line 144 of file model_selection.h.

◆ genetic_algorithm

GeneticAlgorithm genetic_algorithm
private

Genetic algorithm object to be used for inputs selection.

Definition at line 132 of file model_selection.h.

◆ growing_inputs

GrowingInputs growing_inputs
private

Growing inputs object to be used for inputs selection.

Definition at line 124 of file model_selection.h.

◆ growing_neurons

GrowingNeurons growing_neurons
private

Growing neurons object to be used for neurons selection.

Definition at line 120 of file model_selection.h.

◆ inputs_selection_method

InputsSelectionMethod inputs_selection_method
private

Type of inputs selection algorithm.

Definition at line 140 of file model_selection.h.

◆ neurons_selection_method

NeuronsSelectionMethod neurons_selection_method
private

Type of neurons selection algorithm.

Definition at line 136 of file model_selection.h.

◆ pruning_inputs

PruningInputs pruning_inputs
private

Pruning inputs object to be used for inputs selection.

Definition at line 128 of file model_selection.h.

◆ training_strategy_pointer

TrainingStrategy* training_strategy_pointer = nullptr
private

Pointer to a training strategy object.

Definition at line 116 of file model_selection.h.


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