Skip to Content
Python机器学习手册:从数据预处理到深度学习
book

Python机器学习手册:从数据预处理到深度学习

by Chris Albon
July 2019
Intermediate to advanced
365 pages
8h 13m
Chinese
Publishing House of Electronics Industry
Content preview from Python机器学习手册:从数据预处理到深度学习
83
5
处理分类数据
5.0
 简介
有时候,根据某种特性而不是数量来度量对象会更有效。我们常常使用这种定性的信息
来判断一个观察值的属性,比如按照性别、颜色或者车的品牌这样的类别对其分类。但
并不是所有的分类数据都是这样的。本身没有内在顺序的类别称为
nominal
以下类别
都属于
nominal
类别
y
蓝色、红色、绿色
y
男性、女性
y
香蕉、草莓、苹果
相反,如果一组分类天然拥有内在的顺序性,它就被称为
ordinal
例如
y
低、中、高
y
年轻、年迈
y
同意、中立、反对
此外,分类信息常常用一个字符串型的向量或列(例如,
"
Maine
"
"
Texas
"
"
Delaware
"
)表示,但大部分机器学习算法都要求其输入是数值型的数据。
KNN
K-Nearest Neighbor
K
近邻)算法就是一个简单的例子。该算法的第一步是计
算两个观察值之间的距离,通常使用的是欧氏距离
i =1
n
x
i
y
i
2
where x and y are two observations and subscript i denotes the value for the observa‐
tions’ ith feature. However, the distance calculation obviously is impossible if the
value of x
i
is a string (e.g., "Texas"). Instead, we need to convert the string ...
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

精通特征工程

精通特征工程

Alice Zheng, Amanda Casari
精通機器學習

精通機器學習

Aurélien Géron
Python数据分析基础

Python数据分析基础

Clinton W. Brownley

Publisher Resources

ISBN: 9787121369629