from sklearn.ensemble import ExtraTreesClassifier,RandomForestClassifier
from sklearn.tree import DecisionTreeClassifier
from sklearn.model_selection import cross_val_score
from sklearn import datasets
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
#決策樹,進行裂分是根據資訊增益最大進行裂分#極限森林:樣本隨機,分裂條件隨機(不是分類最好的條件)
#梯度提升的原理import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
from sklearn.ensemble import GradientBoostingClassifier
from sklearn import tree
#X:資料 上網時間和購物金額#y:目標值
X = np.array([[800,3],[1200,1],[1800,4],[2500,2]])
y = np.array([14,16,24,26])
```python
gbdt = GradientBoostingClassifier(n_estimators =10)
gbdt.fit(X,y)