Module 9 - Practice - Decision Trees

Back to the course outline

Exercise 1:

Using the diabetes.csv file from the Module 8 Exercises notebook, load the file as a dataframe. Repeat the steps from exercises 1 & 2 in the Module 8 Exercise notebook to prepare your dataset for modeling.

Exercise 2:

Using the decision tree function in the scikit-learn library (sklearn), fit the model with the training dataset. Then score the model for training; how well did it do?

Exercise 3:

Now use the test dataset on the decision tree function and get its score.

Exercise 4:

Make a confusion matrix for the predicted outcomes to compare it against the "true" outcomes. How many values for each outcome did the model get incorrect?

Exercise 5:

Get a classification report on the model for the predicted data. Which outcome is the model more accurate at predicting?

Exercise 6:

Compare the predictions from the decision tree model to the logistic regression model in the Module 8 Exercise notebook. Which model was best at predicting the outcome of diabetes for a patient?

Back to the course outline