Question: The goal is to build a decision tree that, based on the other features in the set, predicts whether or not a patient has malignant

The goal is to build a decision tree that, based on the other features in the set, predicts whether or not a patient has malignant cancer. So this is a classification problem. Using tree.DecisionTreeClassifier and other functions in the scikit-learn library, one can build a decision tree and calculate both its training accuracy when fitted to the entire data set as well as its accuracy using 10-fold cross validation (which gives a better idea of true accuracy). In this question you will need to complete two sub-components: (a) [6 points] Make a plot visualizing the performance of a tree.DecisionTreeClassifier as you search for an optimal max depth parameter. Vary the depth of your decision tree using max depth = 1,2,. . . ,10 and record the results from the following evaluation procedures for each setting: The accuracy when training and testing on the full dataset. 10-fold cross-validated accuracy. Plot the results of both evaluation procedures on the same plot with evaluation scores on the y-axis and max depth values on the x-axis. Use 10 as your random seed/state for the decision tree and the cross-validation. Use a legend to label both evaluation procedures. (b) [4 points] Answer the questions below based on the results of 2a. Write your answers in the corresponding field in the markdown cell that is present in the HW1 template notebook. You can do this by double clicking the markdown cell and writing your answer directly in the cell. Pressing enter will re-render the markdown.

1

i. What setting of max depth gave the best accuracy w.r.t. the full-dataset accuracy? If more than one setting equaled the best accuracy, list each of the best settings. ii. What setting of max depth gave the best accuracy w.r.t. the cross-validated accuracy? If more than one setting equaled the best accuracy, list each of the best settings.

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 Databases Questions!