Hands-On Machine Learning with Scikit-Learn and TensorFlow


Random Patches and Random Subspaces



Download 26,57 Mb.
Pdf ko'rish
bet161/225
Sana16.03.2022
Hajmi26,57 Mb.
#497859
1   ...   157   158   159   160   161   162   163   164   ...   225
Bog'liq
Hands on Machine Learning with Scikit Learn Keras and TensorFlow

Random Patches and Random Subspaces
The 
BaggingClassifier
class supports sampling the features as well. This is con‐
trolled by two hyperparameters: 
max_features
and 
bootstrap_features
. They work
the same way as 
max_samples
and 
bootstrap
, but for feature sampling instead of
instance sampling. Thus, each predictor will be trained on a random subset of the
input features.
This is particularly useful when you are dealing with high-dimensional inputs (such
as images). Sampling both training instances and features is called the 
Random
Patches
 method
.
bootstrap=False
and 
max_sam
ples=1.0
) but sampling features (i.e., 
bootstrap_features=True
and/or 
max_fea
tures
smaller than 1.0) is called the 
Random Subspaces
 method
.
200 | Chapter 7: Ensemble Learning and Random Forests


9
“Random Decision Forests,” T. Ho (1995).
10
The 
BaggingClassifier
class remains useful if you want a bag of something other than Decision Trees.
11
There are a few notable exceptions: 
splitter
is absent (forced to 
"random"
), 
presort
is absent (forced to
False
), 
max_samples
is absent (forced to 
1.0
), and 
base_estimator
is absent (forced to 
DecisionTreeClassi
fier
with the provided hyperparameters).
Sampling features results in even more predictor diversity, trading a bit more bias for
a lower variance.
Random Forests
As we have discussed, a 
Random Forest
trained via the bagging method (or sometimes pasting), typically with 
max_samples
set to the size of the training set. Instead of building a 
BaggingClassifier
and pass‐
ing it a 
DecisionTreeClassifier
, you can instead use the 
RandomForestClassifier
class, which is more convenient and optimized for Decision T(similarly, there is

RandomForestRegressor
class for regression tasks). The following code trains a
Random Forest classifier with 500 trees (each limited to maximum 16 nodes), using
all available CPU cores:

Download 26,57 Mb.

Do'stlaringiz bilan baham:
1   ...   157   158   159   160   161   162   163   164   ...   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