Create 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.

Start page of Neural Designer screenshot

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.

New project screenshot

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.

Data set page screenshot

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.

Data set page screenshot

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.

Neural network page screenshot

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.

Data set page screenshot

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.

Training strategy page screenshot

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 tasks the training 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.

Perform training results table

The training results

5. Improve generalization performance

Neural Designer provides innovative algorithms to automate the model selection process. Model selection is applied to find the topology of a neural network that minimizes the error on new data. There are two ways to obtain an optimal topology, order selection and inputs selection. Order selection algorithms are used to get the optimal number of neurons in the neural network. Inputs selection algorithms are responsible for finding the optimal subset of inputs.

Model selection page screenshot

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.

Confusion matrix

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.