Skip to Content
数据科学中的实用统计学(第2版)
book

数据科学中的实用统计学(第2版)

by Peter Bruce, Andrew Bruce, Peter Gedeck
October 2021
Intermediate to advanced
289 pages
8h 31m
Chinese
Posts & Telecom Press
Content preview from 数据科学中的实用统计学(第2版)
159
5
分类
数据科学家经常需要将业务问题的决策自动化。一封邮件是否在试图进行钓鱼攻击?某个
客户是否有可能流失?网站用户有可能点击这个广告吗?这些都是
分类
问题。分类是一种
监督学习
,我们先使用已知结果的数据训练一个模型,然后将这个模型应用到结果未知的
数据上。分类可能是最重要的预测形式,它的目标是预测一条记录是“
1
”还是“
0
(钓鱼
邮件
/
非钓鱼邮件
、会点击
/
不会点击、会流失
/
不会流失),或者在某些情况下,是几个
类别中的哪一类(例如,
Gmail
收件箱中的邮件分为“
primary
”“
social
”“
promotional
和“
forums
”类)
通常,我们需要的不仅是简单的二元分类,我们想知道的是一个个案属于某个类别的预测
概率。大多数算法不是简单地通过模型给出一个二元分类结果,而是返回每条记录属于相
应类别的概率分数(或者倾向分数)。实际上,使用逻辑回归时,
R
的默认输出是一个对
数发生比,必须转换为倾向分数。在
Python
scikit-learn
中,逻辑回归与其他多数分
类方法一样,提供了两种预测方法:
predict
(返回类别)和
predict_proba
(返回属于每
种类别的概率)。可以使用滑动临界值将倾向分数转换为某种决策。常用的方法如下所示。
1.
为感兴趣的类别确定一个临界概率,如果超过这个概率,就认为记录属于这个类别。
2.
(使用任意模型)估计出一条记录属于感兴趣的类别的概率。
3.
如果这个概率超过了临界概率,就向感兴趣的类别中加入这条新记录。
临界概率越高,预测为
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

Python机器学习案例精解

Python机器学习案例精解

Posts & Telecom Press, Yuxi (Hayden) Liu

Publisher Resources

ISBN: 9787115569028