I am printing out the precision score and confusion matrix using sklearn.
print("Confusion matrix:") print(confusion_matrix(test_y, predict_y)) print("Precision:", precision_score(test_y, predict_y))
The output is:
Confusion matrix: [[910 16] [ 47 177]] Precision: 0.917098445595855
According to the confusion matrix:
True positive = 177 False positive = 47
Precision should be 177/(177+47) or about 0.79. This doesn't match what sklearn is showing as precision. What am I doing wrong here?