Skip to Content
深度学习入门 : 基于Python的理论与实现
book

深度学习入门 : 基于Python的理论与实现

by 斋藤康毅
July 2018
Intermediate to advanced
310 pages
8h 21m
Chinese
Posts & Telecom Press
Content preview from 深度学习入门 : 基于Python的理论与实现
3.2  激活函数 
49
神经网络的激活函数必须使用非线性函数。换句话说,激活函数不能使
用线性函数。为什么不能使用线性函数呢?因为使用线性函数的话,加深神
经网络的层数就没有意义了。
线性函数的问题在于,不管如何加深层数,总是存在与之等效的“无
隐藏层的神经网络”。为了具体地(稍微直观地)理解这一点,我们来思
考下面这个简单的例子。这里我们考虑把线性函数h
(
x
) = c
x 作为激活
函数,把 y
(
x
) =
h
(
h
(
h
(
x
)))
的运算对应3 层神经网络
A
。这个运算会进行
y
(
x
) = c × c × c ×
x 的乘法运算,但是同样的处理可以由y
(
x
) =
ax(注
a
= c
3
)这一次乘法运算(即没有隐藏层的神经网络)来表示。如本例所示,
使用线性函数时,无法发挥多层网络带来的优势。因此,为了发挥叠加层所
带来的优势,激活函数必须使用非线性函数。
3.2.7
 ReLU函数
到目前为止,我们介绍了作为激活函数的阶跃函数和
sigmoid
函数。在
神经网络发展的历史上,
sigmoid
函数很早就开始被使用了,而最近则主要
使用ReLU
Rectified Linear Unit
)函数。
ReLU
函数在输入大于0 时,直接输出该值;在输入小于等于0 时,输
0(图 3
-
9)。
ReLU
函数可以表示为下面的式
(
3.7
)
3.7
如图3
-
9 式(3.7)所
ReLU
函数是一个非常简单的函数。因此,
ReLU
函数的实现也很简单,可以写成如下形式。
def relu(x):
return np.maximum(0, x) ...
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

ルールズ・オブ・プログラミング ―より良いコードを書くための21のルール

ルールズ・オブ・プログラミング ―より良いコードを書くための21のルール

Chris Zimmerman, 久富木 隆一

Publisher Resources

ISBN: 9787115485588