<jupyter_start><jupyter_text>Model - Decision Tree- ensemble learning    - Random Forest: ensemble.RandomForestClassiﬁer (Bagging)    - Adaboost: ensemble.AdaBoostClassiﬁer (Boosting)    - Xgboost    - GBDT: ensemble.GradientBoostingClassiﬁer (Boosting) ensemble learning- ensemble estimator - Bagging- Boosting- stacking Reference[ scikit-learn: Ensemble methods ](https://scikit-learn.org/stable/modules/ensemble.htmladaboost)  Import Package Using the Red wine data set<jupyter_code>from sklearn.model_selection import GridSearchCV
from sklearn.model_selection import train_test_split

import sklearn.metrics as metrics

from sklearn.tree import DecisionTreeClassifier
from sklearn.ensemble import RandomForestClassifier
from sklearn.ensemble import GradientBoostingClassifier

from sklearn.datasets import load_wine

%matplotlib inline
from sklearn.model_selection import cross_val_score
import matplotlib.pyplot as plt

import numpy as np
wine = load_wine()
print(wine.data)
print(wine.target)<jupyter_output>[[1.423e+01 1.710e+00 2.430e+00 ... 1.040e+00 3.920e+00 1.065e+03]
 [1.320e+01 1.780e+00 2.140e+00 ... 1.050e+00 3.400e+00 1.050e+03]
 [1.316e+01 2.360e+00 2.670e+00 ... 1.030e+00 3.170e+00 1.185e+03]
 ...
 [1.327e+01 4.280e+00 2.260e+00 ... 5.900e-01 1.560e+00 8.350e+02]
 [1.317e+01 2.590e+00 2.370e+00 ... 6.000e-01 1.620e+00 8.400e+02]
 [1.413e+01 4.100e+00 2.740e+00 ... 6.100e-01 1.600e+00 5.600e+02]]
[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2]<jupyter_text>Model<jupyter_code># train test split 
X_train, X_test, Y_train, Y_test = train_test_split(wine.data, wine.target,test_size=0.3)

# Model 
dtc = DecisionTreeClassifier(random_state=0)
rfc = RandomForestClassifier(random_state=0)

# gbc = GradientBoostingClassifier(n_estimators=100, learning_rate=1.0,
#                                  max_depth=1, random_state=0)
gbc = GradientBoostingClassifier(random_state=0)


dtc = dtc.fit(X_train,Y_train)
rfc = rfc.fit(X_train,Y_train)
gbc = gbc.fit(X_train, Y_train)

score_dt = dtc.score(X_test,Y_test)
score_rf = rfc.score(X_test,Y_test)
score_gb = gbc.score(X_test,Y_test)

print("Sigle Tree:{}".format(score_dt)) 
print("Random Forest:{}".format(score_rf))
print("Gradient Boosting:{}".format(score_gb))<jupyter_output>Sigle Tree:0.9444444444444444
Random Forest:1.0
Gradient Boosting:1.0
StarcoderdataJupyterStructuredCleanDedup