Search code examples
pythontensorflowkerasdeep-learningrecurrent-neural-network

Keras Loss "NaN"; Likely Exploding Gradient


I'm running an LSTM model to classify astrophysics time series data. I am attempting to classify each time series as either a black hole (1) or not a block hole (0). When I run my RNN, the loss is not decreasing (actually increasing then going to NaN). I cannot figure out how solve this problem. Here is the link to my Jupyter Notebook (which contains more information on the problem).

https://colab.research.google.com/drive/1NJBEIdoeToqdcYooGEtrVfaELtLXwNjZ?usp=sharing#scrollTo=d_HDprISPjZT

Let me know if you know how to solve this problem.


Solution

  • It's probably ReLU; try activation="tanh".

    Here's additional text for no reason because stack overflow thinks one can never answer a question this briefly.