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 面向数据科学家的实用统计学
无监督学习
|
199
我们称一个类内每个记录到该类
均值
之间距离的平方和为
类内平方和
,或简称为“类内
SS
”。
K
-Means
通过最小化类内平方和,将数据划分为
K
个类。
K
-Means
并不能保证各个
类的规模相同,但是能找出相互分离情况最好的类。
归一化
应对连续变量做归一化(标准化),一般做法是减去均值再除以标准偏差。
否则大尺度的变量将会主导聚类过程(参见
6.1.4
节 )。
7.2.1
 一个简单的例子
给定一个具有
n
条记录的数据集,其中只有
x
和
y
两个变量。假设我们想将数据划分为
K
= 4
个类,这意味着每条记录
( , )
i i
x y
将会指定给一个类
k
。假定给类
k
指定了
n
k
条记录,
类的中心
k k
( , )x y
就是类内各记录的均值,即:
类均值
通常情况下,聚类的记录具有多个变量。
类均值
(
cluster mean
)并非指单个
数字,而是指表示变量均值的向量。
类内平方和由下式给出。
K
-Means
将给出一种记录的分配方法,使得所有四个类的类内平方和之和
SS
1
+ SS
2
+ SS
3
+
SS
4
最小化。
4
1
i
k
SS
=
∑
使用
K
-Means
聚类,我们可以深入地了解股票价格走势的聚类情况。注意,股票收益实
际上是以归一化的方式给出的,因此不需要再对数据做归一化。在
R
语言中,可以使用
kmeans 函数执行
K
-Means
聚类。例如,下面的代码使用了
XOM
和
CVX
股票收益这两个
变量,划分出
4
个类。
df <- sp500_px[row.names(sp500_px)>='2011-01-01', c('XOM', 'CVX')] ...
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