First, you need to have discrete class labels to compute confusion matrix. Define a threshold on the predicted positive class probability to predict class labels (y_pred).
You can then use actual class labels (y_actual) and y_pred to compute the confusion matrix.
from sklearn.metrics import confusion_matrix
confusion_matrix(y_actual, y_pred)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…