Question: Part B [ 5 points ] : Build a decision tree classifier using the sklearn toolbox. Then compute metrics for performance like precision and recall.

Part B[5 points] : Build a decision tree classifier using the sklearn toolbox. Then compute metrics for performance like precision and recall. This is a binary classification problem, therefore we can label all points as either positive (SPAM) or negative (NOT SPAM).
In [67]: def build_dt(data_X, data_y, max_depth = None, max_leaf_nodes =None):
This function does the following:
1. Builds the decision tree classifier using sklearn
2. Fits it to the provided data.
Arguments
data_X - a np.ndarray
data_y - np.ndarray
max_depth - None if unrestricted, otherwise an integer for the maximum depth the tree can reach.
Returns:
A trained DecisionTreeClassifier
\# your code here
Part B [ 5 points ] : Build a decision tree

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!