Inconsistent accuracy for same code


When I try to train a simple model with a simple dataset, as instructed here, I get weird result as below.

The accuracy varies a lot when I rerun the same code again and again. Why would this happen? If the variation is narrow, I do not bother, but it widely goes from 70% to 95%, rendering the model totally unreliable. Kindly help.

Code and demo is as below.

With only one epoch of training, the model is not close to converging, so you will see a wide variation in results. Longer training could help you achieve more consistency.

So increase in no of epochs could have resulted in better consistency?

Yes, that should help with consistency