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 面向数据科学家的实用统计学
统计机器学习
|
165
结果
拖欠
偿清
目标
dti
支出与收入的比率
图 6-2:贷款拖欠的 KNN 预测,其中使用了两个变量:贷款与收入的比率,以及偿贷与收入的比率
6.1.2
 距离度量
距离度量
用于判定相似性(接近度),它是一个测量两个记录
(
x
1
,
x
2
,
…
,
x
p
)
和
(
u
1
,
u
2
,
…
,
u
p
)
之间距离的函数。最广为使用的向量距离度量是
欧氏距离
。在测量两个向量间的欧氏距离
时,依次取两个向量中对应元素的差值,并对各个差值平方,累加后再取平方根。计算公
式为:
2 2 2
1 1 2 2
( ) ( ) ( )
p p
x u x u x u− + − + + −
欧氏距离非常容易计算。对于大型数据集,这一点尤为重要,因为
KNN
涉及
K
×
n
次逐对
比较,其中
n
是向量的行数。
如果数据是数值型的,那么另一种常用的距离度量是
曼哈顿距离
,计算公式为:
1 1 2 2 p p
x u x u x u− + − + + −
欧氏距离表示的是两点之间的直线距离。而曼哈顿距离是在某一时刻以同一方向遍历两点
之间的距离,例如遍历矩形城市街区。因此,如果定义相似性为点到点的行程时间,那么
曼哈顿距离更适用。
在测量两个向量之间的距离时,测量值取决于规模相对较大的变量(特征)。以贷款数据
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

精通機器學習

精通機器學習

Aurélien Géron
基于Python的智能文本分析

基于Python的智能文本分析

Benjamin Bengfort, Rebecca Bilbro, Tony Ojeda
Python数据处理

Python数据处理

Jacqueline Kazil, Katharine Jarmul

Publisher Resources

ISBN: 9787115493668