Skip to Content
Python数据科学手册
book

Python数据科学手册

by Jake VanderPlas
January 2018
Intermediate to advanced
470 pages
13h 23m
Chinese
Posts & Telecom Press
Content preview from Python数据科学手册
404
|
第
5
章
图 5-111:
k
-means 簇中心点和用不同颜色区分的簇
告诉你个好消息,
k
-means
算法可以(至少在这个简单的例子中)将点指定到某一个类,
就类似于通过肉眼观察然后将点指定到某个类。但你可能会好奇,这些算法究竟是如何快
速找到这些簇的,毕竟可能存在的簇分配组合方案会随着数据点的增长而呈现指数级增
长趋势,如果要做这样的穷举搜索需要消耗大量时间。好在有算法可以避免这种穷举搜
索——
k
-means
方法使用了一种容易理解、便于重复的
期望最大化
算法取代了穷举搜索。
5.11.2
 
k
-means
算法
:
期望最大化
期望最大化(
expectation-maximization
,
E-M
)是一种非常强大的算法,应用于数据科学
的很多场景中。
k
-means
是该算法的一个非常简单并且易于理解的应用,下面将简单介绍
E-M
算法。简单来说,期望最大化方法包含以下步骤。
(1)
猜测一些簇中心点。
(2)
重复直至收敛。
a.
期望步骤
(
E-step
):将点分配至离其最近的簇中心点。
b.
最大化步骤
(
M-step
):将簇中心点设置为所有点坐标的平均值。
期望步骤(
E-step
或
Expectation step
)不断更新每个点是属于哪一个簇的期望值,最大
化步骤(
M-step
或
Maximization step
)计算关于簇中心点的拟合函数值最大化对应坐标
(
argmax
函数)——在本例中,通过简单地求每个簇中所有数据点坐标的平均值得到了簇
中心点坐标。
关于这个算法的资料非常多,但是这些资料都可以总结为:在典型环境下 ...
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

Luciano Ramalho
Python数据分析基础

Python数据分析基础

Clinton W. Brownley
Python数据处理

Python数据处理

Jacqueline Kazil, Katharine Jarmul

Publisher Resources

ISBN: 9787115475893