Skip to Content
面向数据科学家的实用统计学
book

面向数据科学家的实用统计学

by Peter Bruce, Andrew Bruce
October 2018
Beginner to intermediate
238 pages
6h 32m
Chinese
Posts & Telecom Press
Content preview from 面向数据科学家的实用统计学
176
|
第
6
章
如何确定最优
cp 值,这是偏差与方差间权衡问题的又一个实例(参见
6.1.5
节中的知识
点“偏差与方差的权衡”)。最常用的 cp 值估计方法是使用交叉验证(参见
4.2.3
节),步
骤如下。
(1)
将数据分为训练集和验证集。
(2)
使用训练集生长树模型。
(3)
逐步剪枝,并在每步记录 cp 值(使用
训练集
)。
(4)
注意在
验证集
上取得最小误差(损失)的 cp 值。
(5)
将数据重新拆分为训练集和验证集,并重复树模型的生长、剪枝和记录 cp 过程。
(6)
重复执行上述步骤,对反映每个树的最小误差的 cp 值求平均值。
(7)
回到原始数据,也可以是将要处理的数据上,生长树模型,并在最优 cp 值处终止执行
算法。
在 rpart 软件包中,可以使用参数 cptable 生成一个表,记录 cp 值及相关联的交叉验证误
差(即
R
语言中的 xerror),进而确定具有最低交叉验证误差的 cp 值。
6.2.5
 预测连续值
使用树模型预测连续值(也被称为
回归
)时,遵循着同样的逻辑和过程,不同之处是使用
每个子分区中距离均值的平方偏差(平方误差)来度量不纯度,并通过每个分区中的均方
误差的平方根判断预测性能(参见
4.2.2
节 )。
6.2.6
 如何使用树模型
企业中的预测建模者面临的一大障碍,就是所使用的预测方法在本质上是一种“黑箱”,
而“黑箱”操作会引发企业中其他人员的反对。针对这一问题,树模型至少在以下两个方
面颇具吸引力。
•
树模型提供了一种可视化的数据探索工具,有助于人们掌握重要的变量,以及这些变量 ...
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

基于Python的智能文本分析

基于Python的智能文本分析

Benjamin Bengfort, Rebecca Bilbro, Tony Ojeda
Python数据处理

Python数据处理

Jacqueline Kazil, Katharine Jarmul
精通機器學習

精通機器學習

Aurélien Géron
C++语言导学(原书第2版)

C++语言导学(原书第2版)

本贾尼 斯特劳斯特鲁普

Publisher Resources

ISBN: 9787115493668