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 版)
173
第 7 章
集成学习和随机森林
如果你随机向几千个人询问一个复杂问题,然后汇总他们的回答。在许多情况下,你会
发现,这个汇总的回答比专家的回答还要好,这被称为群体智慧。同样,如果你聚合一
组预测器(比如分类器或回归器)的预测,得到的预测结果也比最好的单个预测器要好。
这样的一组预测器称为集成,所以这种技术也被称为集成学习,而一个集成学习算法则
被称为集成方法。
例如,你可以训练一组决策树分类器,每一棵树都基于训练集不同的随机子集进行训
练。做出预测时,你只需要获得所有树各自的预测,然后给出得票最多的类别作为预测
结果(见第 6 章练习题 8 )。这样一组决策树的集成被称为随机森林,尽管很简单,但它
是迄今可用的最强大的机器学习算法之一。
此外,正如我们在第 2 章讨论过的,在项目快要结束时,你可能已经构建好了一些不错
的预测器,这时就可以通过集成方法将它们组合成一个更强的预测器。事实上,在机器
学习竞赛中获胜的解决方案通常都涉及多种集成方法(最知名的是 Nerflix 大奖赛)。
本章我们将探讨最流行的几种集成方法,包括 bagging、boosting、stacking 等,也将探
索随机森林。
7.1 投票分类器
假设你已经训练好了一些分类器,每个分类器的准确率约为 80%。大概包括一个逻辑回
归分类器、一个 SVM 分类器、一个随机森林分类器、一个 K- 近邻分类器,或许还有更
多(见图 7-1)。
这时,要创建出一个更好的分类器,最简单的办法就是聚合每个分类器的预测,然
后将得票最多的结果作为预测类别。这种大多数投票分类器被称为硬投票分类器(见 ...
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