Search code examples
kerasdeep-learninglstm

keras predict_proba return values higher than 1


I am using LSTM for binary classification therefore my last dense layer looks like that:

model.add(Dense(1,activation='sigmoid'))

I want to get the probability for each input but

model.predict_proba(X_test)  

return values bigger than 1. I understand that it because I didnt use 'softmax' in the last layer but at binary classification I have to use sigmoid yet how can I could get probabilities range [0,1]?

the values I get now is:

array([[1.1198873e-07],
       [1.1001220e-07],
       [7.2163729e-08],
       ...,
       [1.1758399e-09],
       [1.6062747e-10],
       [1.5407189e-11]], dtype=float32)

Solution

  • Those values are not above one. This is scientific notation.
    1.1198873e-07 = 1.1198873/10,000,000 = 0.00000011198873
    So these are actually far below 1.