import numpy as np
from sklearn.ensemble import GradientBoostingClassifier
from sklearn import datasets
from sklearn.model_selection import train_test_split
X,y = datasets.load_iris(True)
cond = y!=2
X = X[cond]
y = y[cond]
X_train,X_test, y_train,y_test = train_test_split(X,y,test_size = 0.2)
gbdt = GradientBoostingClassifier(n_estimators=10)
gbdt.fit(X_train,y_train)
gbdt.score(X_test, y_test)
1.0
gbdt.n_estimators_
10
y
array([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])
gbdt.estimators_.shape
(10, 1)