Errors

The error message "when run through the nn model all the values are nan" indicates that the neural network is encountering NaN (Not a Number) values during its forward pass. This is usually due to the presence of extreme values, such as very large or very small numbers, in the inputs or gradients during the computation. This can lead to numerical instability and cause the network to produce NaN values.

To resolve this issue, you can try the following:

  • Debugging the inputs to the network to see if there are any extreme values
  • Clipping the gradients to a specific range during training
  • Reducing the learning rate
  • Initializing the weights with small random values
  • Adding regularization to the model

If none of these solutions works, you might need to try a different architecture or modify the data preprocessing steps to handle extreme values in a better way.

Note

By reducing the learning rate solved my problem.

the problem was identified by seeing the mean value of the variable, if it's much closer to zero then the problem is to reduce the LR