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 面向数据科学家的实用统计学
无监督学习
|
203
7.2.4
 选择类的个数
要使用
K
-Means
算法,必须指定类的个数
K
。在一些情况下,类数是由应用决定的。例
如,一家销售人员管理公司希望将客户群聚类为不同的“人物角色”,这样可以有针对性
地引导电话销售。在这种情况下,管理上的考虑决定了所需的客户类数。如果设置两个
类,可能无法反映出客户之间的差异;而如果设置
8
个类,可能会过多而难以管理。
如果没有实际的或管理上的考虑来决定类数,可以使用统计方法。并不存在一种可以给出
“最佳”类数的标准方法。
一种常用的方法是“肘部法则”(
elbow method
),它能确定一组类何时解释了数据中的
“大部分”方差。在这样一组类之上添加新的类,对于解释方差的贡献较小。“肘部”是指
解释的累积方差在陡峭上升之后变为平整的转折点,方法也因此得名。
图
7-6
显示了类数从
2
增加到
15
时,针对默认数据解释的方差的累积百分比。那么该例的
“肘部”在哪里?答案是没有明显的肘部,因为所解释的方差增量呈逐渐下降。如果数据
中缺少良好定义的类,那么该问题是普遍存在的。这或许是肘部方法的一个缺点,尽管它
的确能揭示数据的本质。
类的个数
解释方差占比(%)
图 7-6:对股票数据应用肘部法则
R
语言的 kmeans 函数并没有提供单独的命令去应用肘部法则,但是肘部法则很容易应用于
kmeans 函数的输出,如下所示。
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