Question: Write a program that splits a dataset into training and test set, builds a classification tree, and outputs a confusion matrix. The program should do
Write a program that splits a dataset into training and test set, builds a classification tree, and outputs a confusion matrix. The program should do the following:
load the iris.csv dataset
create a dataframe, x using the petallength and sepallength as features
create a dataframe, y using species
split the data into training and test sets with test size and randomstate
standardize xtrain and xtest
initialize the decision tree with criterion "gini", randomstate maxdepth minsamplesleaf
run the decision tree on xtest
generate the confusion matrix
The output should be:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
