model_selection.h
1// OpenNN: Open Neural Networks Library
2// www.opennn.net
3//
4// M O D E L S E L E C T I O N C L A S S H E A D E R
5//
6// Artificial Intelligence Techniques SL
7// artelnics@artelnics.com
8
9#ifndef MODELSELECTION_H
10#define MODELSELECTION_H
11
12// System includes
13
14#include <iostream>
15#include <fstream>
16#include <string>
17#include <sstream>
18#include <cmath>
19#include <ctime>
20
21// OpenNN includes
22
23#include "config.h"
24#include "training_strategy.h"
25#include "growing_neurons.h"
26#include "growing_inputs.h"
27#include "pruning_inputs.h"
28#include "genetic_algorithm.h"
29
30namespace OpenNN
31{
32
34
38
40{
41
42public:
43
44 // Constructors
45
46 explicit ModelSelection();
47
49
50 // Destructor
51
52 virtual ~ModelSelection();
53
55
56 enum class NeuronsSelectionMethod{GROWING_NEURONS};
57
59
60 enum class InputsSelectionMethod{GROWING_INPUTS, PRUNING_INPUTS, GENETIC_ALGORITHM};
61
62 // Get methods
63
65 bool has_training_strategy() const;
66
69
71
75
76 // Set methods
77
78 void set(TrainingStrategy*);
79
80 void set_default();
81
82 void set_display(const bool&);
83
85 void set_neurons_selection_method(const string&);
86
88 void set_inputs_selection_method(const string&);
89
90 // Model selection methods
91
92 void check() const;
93
95
97
98 // Serialization methods
99
100 void from_XML(const tinyxml2::XMLDocument&);
101
102 void write_XML(tinyxml2::XMLPrinter&) const;
103
104 string write_neurons_selection_method() const;
105 string write_inputs_selection_method() const;
106
107 void print() const;
108 void save(const string&) const;
109 void load(const string&);
110
111private:
112
114
116
118
120
122
124
126
128
130
132
134
136
138
140
142
143 bool display = true;
144};
145
146}
147
148#endif
This concrete class represents a genetic algorithm, inspired by the process of natural selection such...
This concrete class represents a growing inputs algorithm for the InputsSelection as part of the Mode...
This concrete class represents a growing neurons algorithm for the NeuronsSelection as part of the Mo...
This class represents the concept of model selection algorithm in OpenNN.
const InputsSelectionMethod & get_inputs_selection_method() const
Returns the type of algorithm for the inputs selection.
GrowingInputs * get_growing_inputs_pointer()
Returns a pointer to the growing inputs selection algorithm.
PruningInputs pruning_inputs
Pruning inputs object to be used for inputs selection.
TrainingStrategy * training_strategy_pointer
Pointer to a training strategy object.
NeuronsSelectionMethod
Enumeration of all the available neurons selection algorithms.
void from_XML(const tinyxml2::XMLDocument &)
void set_default()
Sets the members of the model selection object to their default values.
GrowingInputs growing_inputs
Growing inputs object to be used for inputs selection.
ModelSelection()
Default constructor.
void check() const
Checks that the different pointers needed for performing the model selection are not nullptr.
void load(const string &)
NeuronsSelectionResults perform_neurons_selection()
void set_inputs_selection_method(const InputsSelectionMethod &)
GrowingNeurons * get_growing_neurons_pointer()
Returns a pointer to the growing neurons selection algorithm.
bool display
Display messages to screen.
GeneticAlgorithm genetic_algorithm
Genetic algorithm object to be used for inputs selection.
InputsSelectionResults perform_inputs_selection()
const NeuronsSelectionMethod & get_neurons_selection_method() const
Returns the type of algorithm for the neurons selection.
void save(const string &) const
virtual ~ModelSelection()
Destructor.
GrowingNeurons growing_neurons
Growing neurons object to be used for neurons selection.
TrainingStrategy * get_training_strategy_pointer() const
Returns a pointer to the training strategy object.
NeuronsSelectionMethod neurons_selection_method
Type of neurons selection algorithm.
void set(TrainingStrategy *)
InputsSelectionMethod
Enumeration of all the available inputs selection algorithms.
void print() const
Prints to the screen the XML representation of this model selection object.
void set_display(const bool &)
PruningInputs * get_pruning_inputs_pointer()
Returns a pointer to the pruning inputs selection algorithm.
void write_XML(tinyxml2::XMLPrinter &) const
bool has_training_strategy() const
GeneticAlgorithm * get_genetic_algorithm_pointer()
Returns a pointer to the genetic inputs selection algorithm.
InputsSelectionMethod inputs_selection_method
Type of inputs selection algorithm.
void set_neurons_selection_method(const NeuronsSelectionMethod &)
This concrete class represents a pruning inputs algorithm for the InputsSelection as part of the Mode...
This class represents the concept of training strategy for a neural network in OpenNN.
This structure contains the results from the inputs selection.
This structure contains the results from the neurons selection.