Answered step by step
Verified Expert Solution
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 scikitlearn 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 fold cross validation which gives a better idea of true accuracy In this question you will need to complete two subcomponents:
a
a Make a plot visualizing the performance of a tree.DecisionTreeClassifier as you search for an optimal maxdepth parameter. Vary the depth of your decision tree using max depth and record the results from the following evaluation procedures for each setting:
The accuracy when training and testing on the full dataset.
fold crossvalidated accuracy.
Plot the results of both evaluation procedures on the same plot with evaluation scores on the yaxis and max depth values on the xaxis. Use as your random seedstate for the decision tree and the crossvalidation. Use a legend to label both evaluation procedures.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started