Decision Tree and Model Evaluation_Assignment

pdf

School

Laikipia University *

*We aren’t endorsed by this school

Course

628

Subject

Computer Science

Date

Nov 24, 2024

Type

pdf

Pages

1

Uploaded by ColonelSnail2721

Report
CS628 - Data Science Week 8 Assignment Monroe College For Exercises 1 to 4, work with the adult_ch6_training and adult_ch6_test data sets. Use either Python to solve each problem. Import required packages as shown below 1. # import required packages 2. import os 3. import graphviz 4. import pandas as pd 5. import numpy as np 6. import statsmodels.tools.tools as stattools 7. from sklearn.tree import DecisionTreeClassifier, export_graphviz 8. 9. # read the csv adult_ch6_training data using the pandas package 10. adult_tr = pd.read_csv( "/Users/markmaxwell/Desktop/Website Data Sets/adult_ch6_training " ) 11. 12. # read the csv adult_ch6_test data using the pandas package 13. adult_test = pd.read_csv( "/Users/markmaxwell/Desktop/Website Data Sets/adult_ch6_test" ) 1. Create a CART model using the training data set that predicts income using marital status and capital gains and losses. Visualize the decision tree (that is, provide the decision tree output). Describe the first few splits in the decision tree. 2. Develop a CART model using the test data set that utilizes the same target and predictor variables. Visualize the decision tree. Compare the decision trees. Does the test data result match the training data result? 3. Use the training data set to build a C5.0 model to predict income using marital status and capital gains and losses. Specify a minimum of 75 cases per terminal node. Visualize the decision tree. Describe the first few splits in the decision tree. 4. How does your C5.0 model compare to the CART model? Describe the similarities and differences.
Discover more documents: Sign up today!
Unlock a world of knowledge! Explore tailored content for a richer learning experience. Here's what you'll get:
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help