Answered step by step
Verified Expert Solution
Question
1 Approved Answer
For Exercises 1 to 4 , work with the adult _ ch 6 _ training and adult _ ch 6 _ test data sets. Use
For Exercises to work with the adultchtraining and adultchtest data sets.
Use either Python to solve each problem. Import required packages as shown below
# import required packages
import os
import graphviz
import pandas as pd
import numpy as np
import statsmodels.tools.tools as stattools
from sklearn.tree import DecisionTreeClassifier, exportgraphviz
# read the csv adultchtraining data using the pandas package
adulttr pdreadcsvUsersmarkmaxwellDesktopWebsite Data Setsadultchtraining
# read the csv adultchtest data using the pandas package
adulttest pdreadcsvUsersmarkmaxwellDesktopWebsite Data Setsadultchtest"
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.
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?
Use the training data set to build a C model to predict income using marital status and capital
gains and losses. Specify a minimum of cases per terminal node. Visualize the decision tree.
Describe the first few splits in the decision tree.
How does your C model compare to the CART model? Describe the similarities and differences.
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