Reputation: 127
I am a beginner at Tensorflow Neural Networks, and I am following an online guide to learn how to train Sequential Neural Network models. When computing the mean squared error of my test data, I get very different results every time I compile the model. Sometimes I get a MSE of about 27 to 28, and other times I get a very strange MSE of ~20,000. I am not changing any variables every time I recompile my model. Why is this happening? Thanks for responding.
Upvotes: 2
Views: 231
Reputation: 1134
If you are not loading pretrained weights, your model will load with different weights every time you recompile your model, thus giving you random values on inference before training. To ensure that weights are the same for each run, set a random seed in tf.random.set_seed(SEED)
.
Upvotes: 1