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
39
41{
42
43public:
44
45 // Constructors
46
47 explicit ModelSelection();
48
50
51 // Destructor
52
53 virtual ~ModelSelection();
54
56
57 enum class NeuronsSelectionMethod{GROWING_NEURONS};
58
60
61 enum class InputsSelectionMethod{GROWING_INPUTS, PRUNING_INPUTS, GENETIC_ALGORITHM};
62
63 // Get methods
64
66 bool has_training_strategy() const;
67
70
72
76
77 // Set methods
78
79 void set(TrainingStrategy*);
80
81 void set_default();
82
83 void set_display(const bool&);
84
86 void set_neurons_selection_method(const string&);
87
89 void set_inputs_selection_method(const string&);
90
91 // Model selection methods
92
93 void check() const;
94
96
98
99 // Serialization methods
100
101 void from_XML(const tinyxml2::XMLDocument&);
102
103 void write_XML(tinyxml2::XMLPrinter&) const;
104
105 string write_neurons_selection_method() const;
106 string write_inputs_selection_method() const;
107
108 void print() const;
109 void save(const string&) const;
110 void load(const string&);
111
112private:
113
115
117
119
121
123
125
127
129
131
133
135
137
139
141
143
144 bool display = true;
145};
146
147}
148
149#endif
This concrete class represents a growing inputs algorithm for the InputsSelection as part of the Mode...
This concrete class represents an growing neurons algorithm for the NeuronsSelection as part of the M...
This class represents the concept of model selection[1] 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.