Answered step by step
Verified Expert Solution
Question
1 Approved Answer
THE OUTPUT MUST BE EXACTLY THE SAME! Write a program that splits a dataset into training and test set, builds a classification tree, and outputs
THE OUTPUT MUST BE EXACTLY THE SAME!
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 petal_length and sepal_length as features - create a dataframe, y, using species - split the data into training and test sets with 0.25 test size and random_state =0 - standardize x_train and x_test - initialize the decision tree with criterion = "gini", random_state =100, max_depth=3, min_samples_leaf=5 - run the decision tree on x test - generate the confusion matrix The output should be: [1300][0151][036]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