Hands-On Machine Learning with Scikit-Learn and TensorFlow



Download 26,57 Mb.
Pdf ko'rish
bet137/225
Sana16.03.2022
Hajmi26,57 Mb.
#497859
1   ...   133   134   135   136   137   138   139   140   ...   225
Bog'liq
Hands on Machine Learning with Scikit Learn Keras and TensorFlow

Class
Time complexity
Out-of-core support Scaling required Kernel trick
LinearSVC
O(
m
× 
n
)
No
Yes
No
SGDClassifier
O(
m
× 
n
)
Yes
Yes
No
SVC
O(
m
² × 
n
) to O(
m
³ × 
n
) No
Yes
Yes
SVM Regression
As we mentioned earlier, the SVM algorithm is quite versatile: not only does it sup‐
port linear and nonlinear classification, but it also supports linear and nonlinear
regression. The trick is to reverse the objective: instead of trying to fit the largest pos‐
sible street between two classes while limiting margin violations, SVM Regression
tries to fit as many instances as possible 
on
the street while limiting margin violations
(i.e., instances 
off
the street). The width of the street is controlled by a hyperparame‐
ter 
ϵ

Figure 5-10
 shows two linear SVM Regression models trained on some random
linear data, one with a large margin (
ϵ
= 1.5) and the other with a small margin (
ϵ
=
0.5).
166 | Chapter 5: Support Vector Machines


Figure 5-10. SVM Regression
Adding more training instances within the margin does not affect the model’s predic‐
tions; thus, the model is said to be 
ϵ
-insensitive
.
You can use Scikit-Learn’s 
LinearSVR
class to perform linear SVM Regression. The
following code produces the model represented on the left of 
Figure 5-10
 (the train‐
ing data should be scaled and centered first):
from
sklearn.svm
import
LinearSVR
svm_reg
=
LinearSVR
(
epsilon
=
1.5
)
svm_reg
.
fit
(
X

y
)
To tackle nonlinear regression tasks, you can use a kernelized SVM model. For exam‐
ple, 
Figure 5-11
shows SVM Regression on a random quadratic training set, using a
2
nd
-degree polynomial kernel. There is little regularization on the left plot (i.e., a large
C
value), and much more regularization on the right plot (i.e., a small 
C
value).
Figure 5-11. SVM regression using a 2
nd
-degree polynomial kernel

Download 26,57 Mb.

Do'stlaringiz bilan baham:
1   ...   133   134   135   136   137   138   139   140   ...   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