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 面向数据科学家的实用统计学
218
|
第
7
章
离,但这已经说明了分类变量趋向于聚集在类中。
图 7-13:对具有多种类型变量的贷款拖欠数据样本应用
hclust
所生成的树状图
7.5.4
 混合数据的聚类问题
K
-Means
和主成分分析最适合用于连续变量。对于较小的数据集,使用基于高氏距离的层
次聚类更好。从原理上看,
K
-Means
完全适用于二元数据和分类数据。我们通常会使用
“独热编码”(参见
6.1.3
节),将分类数据转换为数值型数据。然而在实践中,很难对二元
数据应用
K
-Means
和主成分分析。
如果使用标准的
z
分数,那么二元变量将会主导聚类的定义。这是因为
0/1
变量只有两个
值,而
K
-Means
是通过将所有的
0
或
1
记录指定给聚类,获得较小的类内平方和。例如,
下面我们将 kmeans 函数应用于具有因子变量 home 和 pub_rec_zero 的贷款拖欠数据。
df <- model.matrix(~ -1 + dti + payment_inc_ratio + home + pub_rec_zero,
data = defaults)
df0 <- scale(df)
km0 <- kmeans(df0, centers=4, nstart=10)
centers0 <-scale(km0$centers, center=FALSE,
scale=1/attr(df0, 'scaled:scale'))
round(scale(centers0, center=-attr(df0, 'scaled:center'), ...
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