Getting 0 accuracy and NaN mae for all epochs training my NN Background:
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.
Issue:
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. How do I resolve this?
I've attached the code below
#all necessary imports

df=pd.read_csv('train.txt')

model= Sequential([
               Dense(units=16,activation='relu',input_shape=(5,)),
               Dense(units=32,activation='relu'),
               Dense(units=10,activation='relu'),
               Dense(units=1,activation='softmax')
            ])

model.compile(optimizer=Adam(learning_rate=0.0001),loss='sparse_categorical_crossentropy',metrics=['accuracy','mae'])

X_train=df[['x','y','theta','u','v']]
Y_train=df['action']

X_train= X_train.astype('float32')/10
Y_train= Y_train.astype('float32')/10

model.fit(X_train,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
Maybe I'm not interpreting this correctly (I don't use Keras), but why does your softmax layer only have a single unit? The softmax function normalizes a vector to represent a probability distribution: $ f : ℝ^n \rightarrow (0,1)^n  $ such that $\sum f(\vec x)=1 $. I would have assumed the softmax layer to use the same number of units as the previous, but again, maybe I'm not understanding Keras.
Usually, gradient explosions cause nan. If you are unfamiliar with it, you could read about the related vanishing gradient problem here. However, in your case, I think the final layer is more suspicious.