Hands-On Machine Learning with Scikit-Learn and TensorFlow



Download 26,57 Mb.
Pdf ko'rish
bet167/225
Sana16.03.2022
Hajmi26,57 Mb.
#497859
1   ...   163   164   165   166   167   168   169   170   ...   225
Bog'liq
Hands on Machine Learning with Scikit Learn Keras and TensorFlow

Gradient Boosting
Another very popular Boosting algorithm is 
Gradient Boosting
.
Just like AdaBoost,
Gradient Boosting works by sequentially adding predictors to an ensemble, each one
correcting its predecessor. However, instead of tweaking the instance weights at every
iteration like AdaBoost does, this method tries to fit the new predictor to the 
residual
errors
made by the previous predictor.
Let’s go through a simple regression example using Decision Trees as the base predic‐
tors (of course Gradient Boosting also works great with regression tasks). This is
called 
Gradient Tree Boosting
, or 
Gradient Boosted Regression Trees
(
GBRT
). First, let’s
fit a 
DecisionTreeRegressor
to the training set (for example, a noisy quadratic train‐
ing set):
Boosting | 207


from
sklearn.tree
import
DecisionTreeRegressor
tree_reg1
=
DecisionTreeRegressor
(
max_depth
=
2
)
tree_reg1
.
fit
(
X

y
)
Now train a second 
DecisionTreeRegressor
on the residual errors made by the first
predictor:
y2
=
y
-
tree_reg1
.
predict
(
X
)
tree_reg2
=
DecisionTreeRegressor
(
max_depth
=
2
)
tree_reg2
.
fit
(
X

y2
)
Then we train a third regressor on the residual errors made by the second predictor:
y3
=
y2
-
tree_reg2
.
predict
(
X
)
tree_reg3
=
DecisionTreeRegressor
(
max_depth
=
2
)
tree_reg3
.
fit
(
X

y3
)
Now we have an ensemble containing three trees. It can make predictions on a new
instance simply by adding up the predictions of all the trees:
y_pred
=
sum
(
tree
.
predict
(
X_new


Download 26,57 Mb.

Do'stlaringiz bilan baham:
1   ...   163   164   165   166   167   168   169   170   ...   225




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish