Skip to Content
精通機器學習
book

精通機器學習

by Aurélien Géron
April 2020
Intermediate to advanced
816 pages
18h 32m
Chinese
GoTop Information, Inc.
Content preview from 精通機器學習
非線性 SVM 分類
|
153
非線性
SVM
分類
雖然線性
SVM
分類器的效果很好
而且經常有令人驚艷的表現
但是很多資料組都很難
線性分隔
加入更多特徵是處理非線性的資料組的一種做法
例如加入多項式特徵
如同
4
章的做法
),
這種做法有時可以產生可線性分隔的資料組
考慮圖
5-5
的左圖
它是
個只有一個特徵
x
1
的簡單資料組
如你所見
這個資料組不是線性可分隔的
但如果你
加入第二個特徵
x
2
= (x
1
)
2
產生的
2D
資料組可以完美地線性分隔
5-5 
加入特徵來讓資料組可以線性分隔
為了使用
Scikit-Learn
來實現這個概念
我們建立一個
Pipeline
裡面有
PolynomialFeatures
轉換器
曾經在第
125
頁的
多項式回歸
介紹
),
接著使用
StandardScaler
LinearSVC
我們用
moons
資料組來測試它
這是一個二元分類玩具資
料組
資料點的形狀是兩個交插的半圓
見圖
5-6)。
你可以用
make_moons()
函式來產生
這個資料組
from sklearn.datasets import
make_moons
from sklearn.pipeline import
Pipeline
from sklearn.preprocessing import
PolynomialFeatures
X, y = make_moons(n_samples=100, noise=0.15)
polynomial_svm_clf = Pipeline([
("poly_features", ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

下一代空间计算:AR与VR创新理论与实践

下一代空间计算:AR与VR创新理论与实践

Erin Pangilinan, Steve Lukas, Vasanth Mohan
C语言核心技术(原书第2版)

C语言核心技术(原书第2版)

Peter Prinz, Tony Crawford

Publisher Resources

ISBN: 9789865024345