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.
Asked
Active
Viewed 250 times
0
-
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 Answers
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
-
-
@Dammio How it is possible? MSE means the sum of the error^2 divided by the number of samples. the number of samples is always >0. – SoheilStar May 09 '21 at 05:20
-