" loss: nan - accuracy: 0.0000e+00 - mae: nan " for all epochs while training my Neural network

Data Science Asked by Aryan Sethi on August 6, 2020

I made a simple game using python library ‘Turtle’ in which there is a long plank with a ball balanced on top of it. I can press right or left arrow keys to rotate the plank (either clockwise or anticlockwise) which makes the ball roll to the either side.

I wanted to train a neural network to make this whole process automated(to balance the ball on plank). So I myself played the game and recorded the states(conditions) and my corresponding actions(buttons pressed) for a period of 2 minutes in the form of a csv. At the end, I got a dataset of 1300 conditions( eg. velocity of ball, direction of velocity, inclination of plank, etc) and the corresponding 1300 actions i took to balance the ball on the plank. Now when I try to train my neural network on this data, I get 0 accuracy and ‘nan’ mae for all the epochs.
Where am i going wrong,

I’ve attached the code below

#all necessary imports


model= Sequential([



X_train= X_train.astype('float32')/10
Y_train= Y_train.astype('float32')/10,Y_train,batch_size=40,epochs=20)

And this is what I’m getting for all the epochs :

loss: nan - accuracy: 0.0000e+00 - mae: nan

Add your own answers!

Ask a Question

Get help from others!

© 2024 All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP