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 版)
168
|
第
6
章
称为正则化。正则化超参数的选择取决于使用的模型,但是通常来说,至少可以限制决
策树的最大深度。在 Scikit-Learn 中,这由超参数 max_depth 控制(默认值为 None,
意味着无限制)。减小 max_depth 可使模型正则化,从而降低过拟合的风险。
DecisionTreeClassifier 类还有一些其他的参数,同样可以限制决策树的形状:
min_samples_split(分裂前节点必须有的最小样本数)、min_samples_leaf(叶
节点必须有的最小样本数量)、min_weight_fraction_leaf(与 min_samples_
leaf 一样,但表现为加权实例总数的占比)、max_leaf_nodes(最大叶节点数量),
以及 max_features(分裂每个节点评估的最大特征数量)。增大超参数 min_* 或减
小 max_* 将使模型正则化。
还可以先不加约束地训练模型,然后再对不必要的节点进行剪枝(删除)。如
果一个节点的子节点全部为叶节点,则该节点可被认为不必要,除非它所表示
的纯度提升有重要的统计意义。标准统计测试(比如
χ
2
测试)用来估算“提升
纯粹是出于偶然”(被称为零假设)的概率。如果这个概率(称之为
p
值)高
于一个给定阈值(通常是 5%,由超参数控制),那么这个节点可被认为不必
要,其子节点可被删除。直到所有不必要的节点都被删除,剪枝过程结束。
图 6-3 显示了在卫星数据集上训练的两个决策树(在第 5 章中介绍)。左侧使用默认的 ...
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