I used the following code to create confusion matrix:
from sklearn.metrics import confusion_matrix
cm = confusion_matrix(df['diabetes'], df['predictions'])
cm
It shows the output as following:
But I want to get the following output:
What should I do?
Assuming the labels and predictions are 0s and 1s, inverting all of the values like this should give the desired behavior
from sklearn.metrics import confusion_matrix
import numpy as np
cm = confusion_matrix(np.abs(df['diabetes']-1), np.abs(df['predictions']-1))
cm