Model Selection class

The model selection is applied to find a neural network with a topology that minimizes the error for new data. There are two ways to obtain an optimal topology, the neurons selection, and the input selection.

Neurons selection algorithms are used to get the optimal number of neurons in the neural network's hidden perceptron layer. Input selection algorithms are responsible for finding the optimal subset of inputs.

As we did in the previous sections, we will continue working with the iris data set, which can be downloaded from the DataSet class chapter. Before continuing, it is also advisable to read the previous chapter, TrainingStrategy class.

To construct a model selection object associated with a training strategy object, we do the following:

ModelSelection model_selection(&training_strategy);

where training_strategy is the training strategy object.

The default model selection consists on a growing inputs selection algorithm, an incremental neurons selection algorithm. The next sentence allows to change

model_selection.set_inputs_selection_method(ModelSelection::GENETIC_ALGORITHM);
model_selection.set_neurons_selection_method(ModelSelection::INCREMENTAL_NEURONS);
GeneticAlgorithm* genetic_algorithm = model_selection.get_genetic_algorithm_pointer();
genetic_algorithm->set_population_size(100);
IncrementalNeurons* incremental_neurons = model_selection.get_incremental_neurons_pointer();
incremental_neurons ->set_maximum_selection_failures(3);

The most important methods of a model selection are the one that perform the inputs and the neurons selection. Respectively, they are called as follows;

model_selection.perform_inputs_selection();
model_selection.perform_neurons_selection();

We can save the above object to a XML file.

model_selection.save("model_selection.xml");

If you need more information about ModelSelection class visit ModelSelection Class Reference.

TestingAnalysis ⇒ ⇐ TrainingStrategy