I’m looking for some help with my neural network. I’m working on a binary classification on a recurrent neural network that predicts stock movements (up and down) Let’s say I’m studying Eur/Usd, I’m using all the data from 2000 to 2017 to train et I’m trying to predict every day of 2018.

The issue I’m dealing with right now is that my program is giving me different answers every time I run it even without changing anything and I don’t understand why?

The accuracy during the train from 2000 to 2017 is around 95% but I’ve noticed another issue. When I train it with 1 new data every day in 2018, I thought 2 epochs was enough, like if it doesn’t find the right answer the first time, then it knows what the answer is since the problem is binary, but apparently that doesn’t work.

Do you guys have any suggestion to stabilize my NN?

  • $\begingroup$ do you think stock movements is a mathematical function? $\endgroup$ – user8426627 Jun 19 '19 at 0:05
  • $\begingroup$ I’m obviously not gonna get 80% of accuracy, and that’s not my goal anyway, I’m just trying to stabilise the prediction for now $\endgroup$ – neomatriciel Jun 19 '19 at 7:53

Firstly, dealing with the issue that the program gives different answers every time without making any changes can be due to a couple of things.

  • Assigning random values to weights and bias. This can be solved by setting a seed manually at the start of the program.
  • Make sure you have set the model to the testing mode after training. For some frameworks, this has to be done manually.

Secondly, regarding your expected results.

To generate a proper accuracy metric, you will have to sample your dataset into training and testing data, making sure there is now overlap between them. This might be an issue as you have stated training on data till 2017 and then again training on data of 2018.

Lastly, don't expect that the model will know that the output is wrong and directly change it because it's binary classification. This is not how neural networks work. The model fits the solution better by gradually updating its weights and biases over a number of iterations. So it will take a number of epochs to learn new trends in the data for 2018.

  • $\begingroup$ I thought about the random weights but I don't think that's the problem here, let me explain : I ran my code 15 times in a row without changing anything with 150 epochs for the big training until 2017, I checked everything on tensorboard and the loss is decreasing going slowly to 0 while the accuracy is increasing going slowly to 1, results are that I get 20% of variation on my correct predictions Then I ran the same test with only 15 epochs, around 0.55 accuracy and a big loss and I only got around 1% of variation on my correct predictions $\endgroup$ – neomatriciel Jun 20 '19 at 10:42
  • $\begingroup$ I tried 100 epochs for the trainings on 2018's everyday data and still, some of them get 0 accuracy $\endgroup$ – neomatriciel Jun 20 '19 at 10:44
  • $\begingroup$ As you have realized, it's true that the accuracy increases as the model is trained over a number of epochs. This is true till the model starts to overfit. $\endgroup$ – skillsmuggler Jun 20 '19 at 20:10
  • $\begingroup$ Regarding the training for 2018 data, the most probable cause of this loss in accuracy is the fact that there is not enough data for the model to train on. In the first case, you have 356 days * 18 years data points, but of 2018 you seem to have only 365 days data points. $\endgroup$ – skillsmuggler Jun 20 '19 at 20:13
  • $\begingroup$ Would it be a better idea to train a single NN for every day of 2018 ? So I would have to train « 365 » ? $\endgroup$ – neomatriciel Jun 25 '19 at 9:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.