Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!