Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions