With Keras Sequential Model Prediction To get Class Labels we can do
yhat_classes1 = Keras_model.predict_classes(predictors)[:, 0] #this shows deprecated warning in tf==2.3.0
WARNING:tensorflow:From <ipython-input-54-226ad21ffae4>:1: Sequential.predict_classes (from tensorflow.python.keras.engine.sequential) is deprecated and will be removed after 2021-01-01.
Instructions for updating:
Please use instead:* `np.argmax(model.predict(x), axis=-1)`, if your model does multi-class classification (e.g. if it uses a `softmax` last-layer activation).* `(model.predict(x) > 0.5).astype("int32")`, if your model does binary classification (e.g. if it uses a `sigmoid` last-layer activation).
or
yhat_classes2 = np.argmax(Keras_model.predict(predictors), axis=1)
With the first class labels if i create confusion matrix, i get
matrix = confusion_matrix(actual_y, yhat_classes1)
[[108579 8674]
[ 1205 24086]]
But with the second class labels with the confusion matrix, i get 0 for True Positive and False Positive
matrix = confusion_matrix(actual_y, yhat_classes2)
[[117253 0]
[ 25291 0]]
May I know whats the issue here?