Design a neural network in 7 steps

In this tutorial we create a neural network that approximates a function defined by a set of data points.

The data for this application can be is stored in the data.csv file.

To solve this application, the next steps are followed:

  1. Create approximation project.
  2. Configure data set.
  3. Set network architecture.
  4. Train neural network.
  5. Improve generalization performance.
  6. Test results.
  7. Deploy model.

1. Create approximation project

Open Neural Designer.
The start page is shown.

Click on the button "New approximation project".
Save the project file in the same folder as the data file.
The main view of Neural Designer is shown.

2. Configure data set

In the "Data set" page, click on the "Import data file" button.
A file chooser dialog will appear.
Select the file "data.csv".
Click on the "Finish" button.
The program loads the data and sets the default configuration.

This data set has 2 variables and 21 samples.

We define the use of the variables:
-The first column represents the independent variable, or "Input", x.
-The second column represents the dependent variable, or "Target", y.
We leave that default values.

Then we define the use of the instances:
-60% of the data is used for training.
-20% of the data is used for selection.
-20% of the data is used for testing.
We leave that default values.

Once the data set is configured, we can run some related tasks.
For instance, in the "Task Manager", click on "Data set> Plot scatter chart".
The viewer window will appear with a chart of the data.
As we can see the shape of this data is a sinus function.

In any project, the quality of the data must be checked by running different data set tasks.

3. Set network architecture

Click on the "Neural network" tab to configure the approximation model.
The next screenshot shows this page.

The "Perceptron layers" section is the most important one here.
By default, the number of layers is 2 (hidden layer and output layer).
By default, the hidden layer has 3 neurons with hyperbolic tangent activation function.
As we have 1 target (y), the output layer must have 1 neuron. The default activation function here is the linear.
We leave that default values.

To visualize the network architecture, click on "Task manager> Neural network> Report neural network".
The viewer window will appear with a graph of the network.

4. Train neural network

In the training strategy page the information about the error method and the optimization algorithm is set.
The next figure shows this page.

The "Normalized squared error" is the default error method. A regularization term is also added here.
The "Quasi-Newton method" is the default optimization algorithm.
We leave that default values.

The most important task is the so-called "Perform training"
which appears in the list of training strategy tasks from the task manager.
Running that task, the optimization algorithm minimizes the loss index, i.e., makes the neural network to fit the data set.
The following figure shows the results from the perform training task in the viewer window.

5. Improve generalization performance

The model selection tab shows the options that allow to configure the model selection process.
The next image shows the content of this page.

"Incremental order" and "Growing inputs" are the default options for order selection and inputs selection respectively.
Since there is only one input, inputs selection won´t be needed.
To perform the order selection, click on "Task manager> Model selection> Perform order selection"
We leave the default values.

6. Test results

When the neural network is designed and trained, Neural Designer offers diverse tasks to test the result offered by the model. For instance, the task "calculate confusion" depicts a table containing the data of a confusion matrix. Each column of the matrix represents the instances in a predicted class while each row represents the instances in an actual class.

7. Deploy model

Once the model has been tested, it is ready to make predictions.

Model deployment tasks allow you to calculate directly outputs, calculate output data in a file, plot directional output, calculate jacobian, write the expression of the predictive model or export the expression for Python and R.