Data set class
The Dataset class contains all the information to build our model. Every column represents a particular variable, and each row corresponds to one sample.
Throughout this tutorial, we will use the Iris data set to give a notion of how to use the most important methods of the main classes which compose OpenNN.
You can download the iris data set here. Notice that the target has been binarized:
- 1 0 0 corresponds to Setosa.
- 0 1 0 corresponds to Versicolor.
- 0 0 1 corresponds to Virginica.
The DataSet class offers a wide variety of constructors. The easiest and the most common way to create a dataset object is by means of the default constructor, which creates an empty data set.
Once we have created the dataset object, the next step is to fill it with data:
By default the last column has been set as output and the remainder as inputs. In order to modify some atributes of the subclass Variables the pointer is needed. For Instance to set the use, units, and name of the variables, we take the variables_pointer.
Similarly to visualize the input and target information you have to use the variable_pointer: <
It is also possible accessing to instances class, through the instances_pointer, for example to split the data.
The first number corresponds to the percentage of training instances, the second number represents the percentage of selection and the last one correspond to the percentage of testing instances by default this values are set as 0.6, 0.2 and 0.2.
Finally, DataSet class implements some useful preprocessing methods, below we present some of them:
- Scaling methods:
- Correlation methods:
Scaling data let the neural network work in better conditions. The following method scale the input data between a minimum and maximum value, and simultaneously returns a structure that shows information about the inputs. This information corresponds to the maximum value, the minimum value, the mean and the standard deviation for each variable.
These scaled data are introduced into the neural network in the training phase.
Correlation provide you better knowledge about which variables have more relation with the targets. This method calculates the linear correlations between all outputs and all inputs.