My model is a binary classifier.

With the same exact architecture, the model sometimes gets high accuracy (90% etc), other times it predicts only one class (so accuracy is stuck at one number the whole time), and other times I get a loss value of “nan” (either too big or small that the loss value is not a number I’m guessing).

I’ve tried simplifying my architecture (down to 2 conv2D layers and 2 dense layers), seeding my kernel initializers with a random number (2), and changing the learning rate, but none of these actually solves the problem of inconsistency (they may help the model train to a high accuracy once, but if I run it again without changing any code, I get a very different result of either unchanging accuracy because it predicts only one class the whole time, or “nan” loss).

How can I fix this problem of: 1. Model having unchanging predictions for the whole run (predicting only one class the whole time). 2. Inconsistent and unreproducible results (when aforementioned issues come and go with no changes to the code) 3. Randomly getting “nan” loss values. (How can I get rid of them permanently?)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.