vendredi 26 octobre 2018

Neural Network Random Seed Affecting Results

I was playing around with the code from the interesting article on time-series regression by James McCaffrey (download).

This essentially uses machine learning to generate a prediction and forecast of the given airline data.

This is my graph generated using the code and data from his article. As you can see, everything appears to be working as normal.

The problem occurs when I attempt to mess with the random variable. He specifically seeds the System.Random object with 0 as seen here: this.rnd = new System.Random(0); (in the NeuralNetwork constructor). The program only uses the rnd variable when it is assigning the initial weights of the network and when it randomizes the order of data to process. The seed should be independent of the data (i.e. the order processed and random weights assigned should not affect the results).

However, observe what happens when I change only the line this.rnd = new System.Random(0); to this.rnd = new System.Random(1);. Here I've done nothing else except seed the System.Random object with 1 instead of 0. Now look at the results:

enter image description here

It is still able to learn and predict the data, however, the forecast is completely wrong! Why does changing the seed have such a significant effect on the results? In theory it shouldn't matter which order data is processed or what the starting weights are, as that's the point of the network, to change the bias until it reaches the solution. Is there something I'm missing?




Aucun commentaire:

Enregistrer un commentaire