Search code examples
machine-learningscikit-learnclassificationconfusion-matrix

Using confusion matrix to find model accuracy instead of built-it predict method


I have a dataset that I want to build a classification model for it. Given that scikit-learn provides confusion matrix implementation confusion_matrix(test_y, pred_r), I want to use it to calculate the accuracy of my model instead of directly using .predict. To do so, should I just look for false positive or true positive or the combination of both?

Thank you


Solution

  • For finding the accuracy, just do this:

    accuracy = (TP + TN)/Total