First, we need a model to evaluate. Let's quickly build and train a random forest:
from sklearn.ensemble import RandomForestClassifierrf = RandomForestClassifier(n_estimators=25, max_features=6, max_depth=4, random_state=61)rf.fit(X_train, y_train)
A confusion matrix is nothing but a table with four different cases that we have in a binary classification problem. In the case of the credit card default problem, we have defined defaults as the positive class. Considering this scenario, we get four possible cases in a binary classification problem.
First, when the model makes a correct prediction we have two possible cases:
- True Positives (TP): The model predicts the positive class and the observation actually ...