Skip to Content
机器学习实战:基于Scikit-Learn、Keras 和TensorFlow (原书第2 版)
book

机器学习实战:基于Scikit-Learn、Keras 和TensorFlow (原书第2 版)

by Aurélien Géron
October 2020
Intermediate to advanced
693 pages
16h 26m
Chinese
China Machine Press
Content preview from 机器学习实战:基于Scikit-Learn、Keras 和TensorFlow (原书第2 版)
152
|
第
5
章
svm_reg = LinearSVR(epsilon=1.5)
svm_reg.fit(X, y)
要解决非线性回归任务,可以使用核化的 SVM 模型。例如,图 5-11 显示了在一个随机
二次训练集上使用二阶多项式核的 SVM 回归。左图几乎没有正则化(C 值很大),右图
则过度正则化(C 值很小)。
图 5-11:使用二阶多项式核的 SVM 回归
以下代码使用 Scikit-Learn 的 SVR 类(支持核技巧)生成如图 5-11 左图所示的模型:
from sklearn.svm import
SVR
svm_poly_reg = SVR(kernel="poly", degree=2, C=100, epsilon=0.1)
svm_poly_reg.fit(X, y)
SVR 类是 SVC 类的回归等价物,LinearSVR 类也是 LinearSVC 类的回归等价物。
LinearSVR 与训练集的大小线性相关(与 LinearSVC 一样),而 SVR 则在训练集变
大时,变得很慢(SVC 也一样)。
SVM 也可用于异常值检测,详细信息请参考 Scikit-Learn 文档。
5.4 工作原理
本节将会介绍 SVM 如何进行预测,以及它们的训练算法是如何工作的,从线性 SVM 分
类器开始。如果你刚刚开始接触机器学习,可以安全地跳过本节,直接进入本章末尾的
练习,等到想要更深入地了解 SVM 时再回来也不迟。
首先,说明一下符号。在第 4 章里,我们使用过一个约定,将所有模型参数放在一个向 ...
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

算法技术手册(原书第2 版)

算法技术手册(原书第2 版)

George T.Heineman, Gary Pollice, Stanley Selkow
管理Kubernetes

管理Kubernetes

Brendan Burns, Craig Tracey

Publisher Resources

ISBN: 9787111665977