Skip to Content
机器学习实战:基于Scikit-Learn、Keras 和TensorFlow (原书第2 版)
book

机器学习实战:基于Scikit-Learn、Keras 和TensorFlow (原书第2 版)

by Aurélien Géron
October 2020
Intermediate to advanced
693 pages
16h 26m
Chinese
China Machine Press
Content preview from 机器学习实战:基于Scikit-Learn、Keras 和TensorFlow (原书第2 版)
60
|
第
2
章
现在你可以删除 income_cat 属性,将数据恢复原样了:
for
set_
in
(strat_train_set, strat_test_set):
set_.drop("income_cat", axis=1, inplace=True)
我们花了相当长的时间在测试集的生成上,理由很充分:这是机器学习项目中经常被忽
视但是却至关重要的一部分。并且,当讨论到交叉验证时,这里谈到的许多想法也对其
大有裨益。现在,是时候进入下一个阶段(数据探索)了。
2.4 从数据探索和可视化中获得洞见
到现在为止,我们还只是在快速浏览数据,从而对手头上正在处理的数据类型形成一个
大致的了解。本阶段的目标是再深入一点。
首先,把测试集放在一边,你能探索的只有训练集。此外,如果训练集非常庞大,你可
以抽样一个探索集,这样后面的操作更简单快捷一些。不过我们这个案例的数据集非常
小,完全可以直接在整个训练集上操作。让我们先创建一个副本,这样可以随便尝试而
不损害训练集:
housing = strat_train_set.copy()
2.4.1 将地理数据可视化
由于存在地理位置信息(经度和纬度),因此建立一个各区域的分布图以便于可视化数据
是一个很好的想法(见图 2-11):
housing.plot(kind="scatter", x="longitude", y="latitude")
纬度
经度
图 2-11:数据的地理散点图
端到端的机器学习项目
|
61
没错,这除了看起来跟加州一样以外,很难再看出任何其他的模式 ...
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

算法技术手册(原书第2 版)

算法技术手册(原书第2 版)

George T.Heineman, Gary Pollice, Stanley Selkow
管理Kubernetes

管理Kubernetes

Brendan Burns, Craig Tracey

Publisher Resources

ISBN: 9787111665977