Machine Learning Tool
Designing your own neural network
On this page, a neural network of any kind can be designed online with just a few simple steps. To do this, you must first define how the network is to be constructed. Then enter the input data together with the desired output data before the network can be trained. Most settings are made automatically. In the end, one can check whether the network is now capable of providing correct and meaningful output data for unknown new input data. Further down, you can load and try out some examples for a deeper understanding.
1. Construction of the neural network
The neural network may have a maximum of 8 layers and 8 neurons per layer. The number of input neurons must correspond to the number of figures in each row of the input field x of the training data. Similarly, the number of output neurons must correspond to the number of figures in each row of the input field y of the training data.
2. Training
The training data (x = input data, y = desired output data) must be entered separated by spaces or new lines. The desired output data must have values between [0..1]. This also makes sense for the input data, but is not strictly necessary. The learning rate is a value that can usually be between 0.01 and 10.0. The larger the value, the faster but also less accurate the training. The number of epochs in turn determines the length of training. An epoch is completed when all rows of the training data have been used for training once. The network shows on a scale from blue (negative values) to red (positive values) how the weights and thresholds change over the course of the training. The values of the weights and thresholds can be displayed by hovering the mouse over them.
3. Testing
Like the training data, the test data must be entered separated from each other by spaces or new lines. However, only the input data x is required, as the trained network will calculate the actual output o on its own.
For advanced users
All calculations in the neural network can be retraced step by step. To do this, any pattern can be sent through the neural network by clicking on all input neurons one after the other and entering the desired values there. Once all inputs are available, the tool switches to activation mode. In this mode, the colours of the weights and thresholds no longer represent the trained values, but the activation of the respective weights and thresholds. Hovering the mouse over the neurons and connections of the neural network will display all the calculations that are necessary to understand the output(s) of the neural network (out = output of the neuron, w = weight value, Act = activation of the neuron, bias = threshold value). Activation mode can be exited by clicking in the free space of the interactive figure.
Example data
In the following, example data can be loaded to train and test a neural network for demonstration purposes. To try out the examples, click the respective button and then click the Train
and Test
buttons to see how the network is trained and how it can implement the training data it has learnt afterwards. As is common with neural networks, it may happen that the training is not successful. In that case, it may help to reload the network or possibly train it further or experimentally change the values for the learning rate or the epochs.
(1) Popular introductory examples are Boolean functions such as the logical or the logical , which only use zeros and ones. The neural network has exactly two input neurons and one output neuron. 0 stands for logically false and 1 for logically true. 14 of the 16 possible functions can be calculated with a 2-1 network, i. e. with a single neuron that has two inputs. However, the XOR and XNOR require one more layer to be able to separate the patterns that should yield 0 from the patterns that should yield 1.
(2) Boolean functions do not have to be limited to two inputs. One of 256 possible three-digit functions is used as an example. The output of the function is 1 if exactly two inputs are 1. In other words, there are two classes of patterns: the first class (0) includes all input rows that do not have exactly two ones, and the second class (1) includes all input patterns that have exactly two ones. At the end of the training, the network can differentiate between these patterns.
(3) In this , a neural network should learn to distinguish between small and large number combinations. The network should output a number close to 0 when it receives small number combina-tions, and a number close to 1 when it receives large number combina-tions. The training data are struc-tured accordingly. The fact that ex-actly four numbers are always taken as the input combination is not rele-vant here and is just an example. There could also be more or less.
(4) One commonly used data set, consisting of 150 input patterns (one pattern per line), lists information on Iris flowers. These are the measured values in centimetres for 150 different iris flowers (lilies), namely the sepal length, sepal width, petal length and petal width of the flower. These four values were collected for 50 Iris setosa, 50 Iris versicolor and 50 Iris virginica. The output data indicate which flower it is: Class 0 is intended to represent the setosa plant, 0.5 the versicolor plant and 1 the virginica plant. In this, 120 data sets are used for training and 30 data sets (10 per flower) for testing, so that it can be checked whether the network really recognises which flower it is based on the characteristics.
(5) The uses the same data, but this time the output data are encoded differently. Instead of training one output neuron on the values 0.0, 0.5 and 1.0 for the three classes, one can simply use three output neurons and set the respective neuron of the desired class to 1, while the other two remain 0. This is called One Hot Encoding.
(6) The last example, although not related to real-world data, shows very nicely how good neural networks are at interpolating between learnt data. Interpolation means “to estimate”. This ability to interpolate can also be used to estimate a function f(x) from (a few) training examples, for which the network can also interpolate all y-values whose x-values were not part of the training data set. A three-layer neural network can even approximate any mathematical function. A function with the between 0 and 1 serves as an example here.
Share this page