Interactive Example

This demo illustrates how a training set is created and shows the result of predicting the function x=f(t) using a backpropagation neural network.

The demo lets you experiment with time-series prediction using a backpropagation neural network. A function, including one with noise, can be used as the basis for a time series to be learned and predicted. You can adjust the parameters of training-set creation and the neural-network parameters. The result, that is, the predicted value, is then compared with the expected future value.

How to work with the demonstration

  • Tip for mobile phones: for the best experience, view in landscape mode - rotate your phone by 90°.
  • Enter a function and the range to work with in the demonstration. After entering it, press Enter and the function will be shown. You can construct a function using the parameter x, numbers, operators /, *, +, -, !, ^, parentheses ( ) and functions abs, acos, acosh, asin, asinh, atan, atanh, cos, cosh, ln, log, sin, sinh, sqr, sqrt, tan and tanh.
    As a noise generator, you can use the function noise(x), where x means the size of the noise (the parameter can also be a function).
  • Enter the parameters for generating the training set, that is, the size of the window, number of samples in one window, the number of examples in the training set and the distance of the predicted value (the number of samples from the end of the window). Sampling is determined by the size of the window and the number of samples in the window. After entering the parameters, press Enter and the result will be shown on the function.
  • The Training Set button shows the generated training set, which can be used for example in other neural networks training systems.
  • The Network Parameters opens a dialog that allows you to set additional parameters of the backpropagation network, such as hidden layers, learning coefficients, and momentum.
  • The Reset Net button resets the network weights to random values.
  • Training starts when you press the Train button. The progress of the learned approximation is shown in red. For faster training, result display can be turned off. During training, the number of epochs is shown together with the error of the current approximation. The error shows the average deviation of the NN outputs from the expected outputs over the whole training set.
  • The Step button trains the network for one epoch.
  • The Error Progress section shows the evolution of the network prediction error. You can select what is displayed. The error on the training set is shown in red, the error on the whole displayed graph is shown in blue, and the error outside the training set (that is, after the training set) is shown in gray. Errors are shown from the moment the window is opened. When this window is not open, errors are not computed, which allows faster training.
  • Working with noise: To add noise to the training set, use the function noise. For example, enter sin(x)+noise(0.5) as the function to be learned - this adds noise of size 0.5 to the sine function. Choose a network and train it on the noisy function. The learned values (in red) correspond to the function with noise. After entering the function without noise, for example sin(x) , you can see how the network responds to data without noise. Usually, the neural network can still predict the function even when there was noise in the training set. To show the result, you of course need to leave result display turned on.
  • Warning: If no network parameter is changed, then nothing is changed in the network, including its topology and weights. This allows to compare how the network learned something different from what is then being predicted, or to illustrate how fast the network unlearns old inputs. However, it can be confusing if you do not realize that the network was not reset after changing some inputs. That is why, to learn from the beginning, you need to reset the network first using the Reset button.

Prediction Graph

Blue shows the source signal and sampled window points. Red shows the learned prediction.

Error Progress

Training, evaluation and test error

Network View

A compact visualization of the current network topology.

Training Set