import numpy as np
from sklearn.pipeline import Pipeline
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import PolynomialFeatures
from sklearn.preprocessing import StandardScaler
from sklearn.metrics import mean_squared_error
from sklearn.linear_model import LogisticRegression
from sklearn import datasets
from sklearn.svm import SVC
from sklearn.ensemble import VotingClassifier
from sklearn.tree import DecisionTreeClassifier
from sklearn.ensemble import BaggingClassifier
digits=datasets.load_iris()
X=digits.data
y=digits.target
# print(y.dtpye)
# print(y)
train_X,test_X,train_y,test_y = train_test_split(X,y,test_size=0.2,random_state=666)
bagging_clf=BaggingClassifier(DecisionTreeClassifier(),n_estimators=500,max_samples=100,bootstrap=True)
bagging_clf.fit(train_X,train_y)
print(bagging_clf.score(test_X, test_y))
# print(dt_reg.score(train_X, train_y))