0

I've come into a bit of a confusing scenario. I'm training a Tensorflow/Keras neural network with a custom loss function and two metrics, MSE and accuracy. When evaluated on the training data, the loss and accuracy return numbers but the MSE is NaN. I was wondering if there was a possible explanation for this. Thanks.

Andre
  • 55
  • 1
  • 4
  • my suggestions: 1- change your optimizer 2- check for nans in your input 3- normalize your input 4-in your target check if labels are correct (the range and etc.) – SoheilStar May 09 '21 at 05:26

1 Answers1

0

Check your input again. The input may have some "Not a Number" values. Refer this: How can I check for NaN values?

Or a quick test:

for value in values:
    print(f"{repr(value):<8} : {is_nan(value)}")
Dammio
  • 911
  • 1
  • 7
  • 15