user1365283
user1365283

Reputation: 9

Running Tensorflow Predictions code twice does *not* result same outcome

I am new to tensorflow, so please pardon my ignorance.

I have a tensorflow demo model "from an online tutorial" that should predict stockmarket prices for S&P. When I run the code I get inconsistent results everytime I run it. Training data does not change, I suppressed block shuffling , ...

But, When I run the prediction 2 times in the same run I get consistent results "i.e. use Only one training , run prediction twice".

My questions are:

  1. Why am I getting inconsistent results?
  2. If you are going to release such code to production , would you just take the last time you ran this model training results? if not, then what would you do?
  3. Does it make sense to force the model to produce consistent predictions? how would you do that?

Here is my code location github repo

Upvotes: 0

Views: 341

Answers (1)

sietschie
sietschie

Reputation: 7543

  1. In training a neural network there is more randomness involved than just the batch shuffling. The initial weights of the layers are also randomly initialized.

  2. Typically you would use the best model you have trained so far. To determine which model is the best you usually use some test dataset you did not use during training.

  3. It is probably not a good sign if your performance fluctuates for different training runs. This means your result depends a lot on the random initialization. But I personally don't know about any general techniques to make learning more stable. But there probably are some.

Upvotes: 1

Related Questions