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机器学习手册:从数据预处理到深度学习
284
18
朴素贝叶斯
y
P
(
y
|
x
1
,...,
x
j
)
叫作后验概率,表示一个观察值在其
j
个特征是
x
1
,...,
x
j
的情况下,它
的分类是类别
y
的概率。
y
P
(
x
1
,...,
x
j
|
y
)
叫作似然概率,表示给定观察值的分类
y
,其特征是
x
1
,...,
x
j
的概率。
y
P
(
y
)
叫作先验概率,是我们在查看数据之前对于分类
y
出现的概率的猜测。
y
P
(
x
1
,...,
x
j
)
叫作边缘概率。
在朴素贝叶斯中,我们对观察值每一个可能的分类的后验概率进行比较。具体来说,因
为在这些比较中边缘概率是恒定不变的,所以只需要比较每个分类的后验概率就好。对
于每一个观察值,后验概率最大的分类就是这个观察值的预测分类。
对于朴素贝叶斯分类器来说,有两个重要的地方需要特别指出。第一,对于数据的每个
特征,必须假定它的似然概率
P(x
j
| y)
的统计学分布。最常用的分布有正态(高斯)分
布、多项式分布和伯努利分布。对这些分布的选择总是由特征的特性(比如连续、二分等)
决定的。第二,朴素贝叶斯得名于一个假设——每个特征和它的似然概率是相互独立的。
这种“朴素”的假设经常是错的,但是在实际操作中它并不影响我们构建一个高品质的
分类器。
在本章中,我们会讲解使用
scikit-learn
基于
3
种不同的似然分布训练
3
种类型的朴素贝
叶斯分类器。
18.1
 为连续的数据训练分类器
问题描述
数据的特征是连续的(非离散值),我们想训练一个朴素贝叶斯分类器。
解决方案
scikit-learn
中使用高斯朴素贝叶斯分类器
#
加载库
from sklearn ...
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