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版)
无监督学习
247
7.2.4
 选择簇的数量
K-
均值算法要求确定簇的数量
K
。有时候簇的数量是由具体应用决定的。例如,一家公司
的销售团队想通过聚类为客户生成“用户画像”,以关注并引导销售需求。在这种情况下,
管理方面的考虑会决定客户分组的数量。如果有两组,就可能得不到有用的客户之间的差
异,而八组又太多,管理起来非常困难。
如果实际情况或管理因素对簇的数量没有要求,那么就可以通过统计方法来确定,不过现
在还没有一种标准方法能够找到“最优”的簇数量。
一种常用的方法称为
肘点法
elbow
method
),它可以识别出何时簇集合能解释数据中的
“大部分”方差,这个时候,向簇集合中加入新簇对解释方差的贡献就非常小。肘点就是
累积解释方差从陡峭上升变为平稳停滞的那个点,这种方法也因此得名。
7-7
显示了当簇的数量为
2
15
,对默认数据中方差解释的累积百分比。那么,这个
例子中的肘点在哪儿呢?没有一个明显的可供选择的点,因为累积解释方差的增量是逐渐
下降的。在没有明显的簇的数据中,这种现象非常正常。这可能是肘点法的一个缺点,但
它确实揭示了数据的本质。
7-7:在股票数据上使用肘点法
R
中,
kmeans
函数没有提供一个单独的命令来应用肘点法,但根据
kmeans
的输出,可
以很容易地使用这种方法,如下所示:
pct_var <- data.frame(pct_var = 0,
num_clusters = 2:14)
totalss <- kmeans(df, centers=14, nstart=50, iter.max=100)$totss ...
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