Session Ready
Exercise

Evaluating four categories

The confusion matrix is the most straightforward tool to look at the four categories of outcomes: true positives (TP), false positives (FP), true negatives (TN), and false negatives (FN). In this exercise, you will use a standard decision tree classifier DecisionTreeClassifier() from sklearn on the sample click data and calculate the breakdowns of outcomes by the four categories.

The pandas module is available as pd in your workspace and the sample DataFrame is loaded as df. The features are loaded in X and the target is loaded in y for use. Additionally, DecisionTreeClassifier from sklearn.tree is available.

Instructions
100 XP
  • Obtain the training and testing splits for X and y.
  • Define a decision tree classifier and produce predictions y_pred by fitting the model.
  • Use the confusion matrix to get the counts for categories of each outcome, with a 1 being a positive (click) and 0 being a negative (non-click).
  • For example: true negatives would be [0,0] and true positives would be [1,1].