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版)
198
|
第
6
章
6.1.2
 距离的度量
相似度(或邻近度)是通过
距离度量
来确定的,这种度量是一个函数,它测量的是两条记
录
(
x
1
,
x
2
,
…
,
x
p
)
和
(
u
1
,
u
2
,
…
,
u
p
)
之间的距离有多远。两个向量之间最常用的距离度量是
欧
氏距离
。要计算两个向量之间的
欧氏距离
,先将它们的分量依次相减,再对得到的差进行
平方,加总之后再取平方根即可:
22 2
11 2 2
( )( ) ( )
pp
xu x u x u− + − ++ −
针对数值型数据的另一种常用距离度量是
曼哈顿距离
:
11 2 2
| || | | |
pp
xu x u x u− + − ++ −
欧氏距离相当于两点之间的直线距离(就像乌鸦飞行一样),而曼哈顿距离是两点之间依
次按照单一方向经过的距离(例如,沿着矩形的城市街区行走)。因此,如果相似度定义
为点对点的行程时间,那么曼哈顿距离就是一种非常有用的近似。
在测量两个向量之间的距离时,使用较大的数量级进行测量的变量(特征)会主导测量结
果。举例来说,在贷款数据中,距离几乎就是收入变量和贷款数额变量的函数,它们的值
都是几万或者几十万的,与之相比,比率变量所起的作用微乎其微。通过对数据进行标准
化可以解决这一问题,参见
6.1.4
节。
其他距离度量
向量之间还有多种其他类型的度量方式。对于数值型数据,
马氏距离
非常引
人关注,因为它考虑了两个变量之间的相关性。马氏距离非常有用,因为如
果两个变量高度相关,它就会将它们作为一个变量来处理。欧氏距离和曼哈
顿距离都没有考虑相关性,在构成相关性的属性上赋予了过多权重。马氏距 ...
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