Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

from sklearn.datasets import load _ iris Using bagging method with a decision tree algorithm, predict with voting method and calculate the accuracy using confusion matrix.

from sklearn.datasets import load_iris
Using bagging method with a decision tree algorithm, predict with voting method and calculate the accuracy using confusion matrix.
Datasets (150 records)
X: sepal length, sepal width, petal length, petal width
Y: species (Versicolor, Setosa, Virginica)
10 bagging datasets (for training 10 classifiers), each with 20 records
1 test dataset that is not sampled during the bootstrapping of 10 training sets.
Training and evaluating classifiers
Generate a decision tree classifier model using the sklearnDecisionTreeClassifier function
Run 10(training) bagging rounds with BaggingClassifier function.
Using the test dataset, predict the labels using majority voting.
Calculate the accuracy using confusion matrix.
- Output
1. Show the 10 bootstrapped training sets
2. Show the test set that is not sampled during the bootstrapping
3. Show a table (dataframe) with predictions from the 10 base learners and the final ensemble learner
4. Show the confusion matrix

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Implementing Ai And Machine Learning For Business Optimization

Authors: Robert K Wiley

1st Edition

B0CPQJW72N, 979-8870675855

More Books

Students also viewed these Databases questions