Intermediate Neural Network Settings

Parent Previous Next

Intermediate Neural Network Settings


By default a neural network consists of one hidden layer and 10 neurons in that layer. This size is enough for simple systems and is resistant to over-fitting. Over-fitting is when the neural network doesn't learn patterns in your data but instead memorizes the outputs for given inputs. So, when you decide to use your neural network in real trading, you will find it peforms poorly. This is the number one problem that all neural networks face. This can be avoided by testing the neural network on data it has never seen before by leaving some data for testing purposes (This can be done with SetPercentTestingData) and monitoring the MSE on the testing data. If the MSE differs greatly between testing and training data, then you have a problem . Having a large training data set also helps to avoid over-fitting.


Quite often the size of the default neural network is not enough to learn the complex relationships in the data if these relationships exist. We can overcome this problem by increasing the number of neurons, adding more hidden layers or both. There are no general rules to follow but the smaller and least complex neural network is more desirable than the more complex and larger neural network. The following functions control the size and complexity of the neural network:


SetNetworkLayer1(NoNeurons) - Set the neural network architecture to have 1 hidden layer and specify how many neurons in that layer. This is the default with 10 neurons.


SetNetworkLayer2(NoNeurons, NoNeurons) - Set the neural network architecture to have 2 hidden layers and specify how many neurons there should be in each layer.


SetNetworkLayer3(NoNeurons, NoNeurons, NoNeurons) - Set the neural network architecture to have 2 hidden layers and specify how many neurons there should be in each layer.