Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
T
Toy-MT-Introduction
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
单韦乔
Toy-MT-Introduction
Commits
507e1ca3
Commit
507e1ca3
authored
Sep 17, 2019
by
xiaotong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
page of MLP for function approximation
parent
a79e7d50
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
82 行增加
和
13 行删除
+82
-13
Section05-Neural-Networks-and-Language-Modeling/section05-test.tex
+82
-13
没有找到文件。
Section05-Neural-Networks-and-Language-Modeling/section05-test.tex
查看文件 @
507e1ca3
...
...
@@ -390,18 +390,19 @@ cycle}
\item
我们可以重复上面的过程,构建
\textbf
{
多层神经网络
}
\end{itemize}
\vspace
{
-
0.5
em
}
\vspace
{
-
1.0
em
}
\begin{center}
\begin{tikzpicture}
\begin{scope}
[]
\def\neuronsep
{
1.6
}
\tikzstyle
{
neuronnode
}
= [minimum size=1.
5em,circle,draw,ublue,very thick,fill=white
,drop shadow=
{
shadow xshift=0.1em,shadow yshift=-0.1em
}
]
\tikzstyle
{
neuronnode
}
= [minimum size=1.
7em,circle,draw,ublue,very thick,inner sep=1pt, fill=white,align=center
,drop shadow=
{
shadow xshift=0.1em,shadow yshift=-0.1em
}
]
%%% layer 1
\foreach
\n
in
{
1,...,5
}{
\node
[neuronnode] (neuron0
\n
) at (
\n
*
\neuronsep
,0)
{}
;
\node
[neuronnode] (neuron0
\n
) at (
\n
*
\neuronsep
,0)
{
\tiny
{$
f
_
1
$}
\\
[-1ex]
\tiny
{$
\sum
$}}
;
\draw
[-,ublue] (neuron0
\n
.east) -- (neuron0
\n
.west);
}
\foreach
\n
in
{
1,...,5
}{
...
...
@@ -421,19 +422,20 @@ cycle}
\node
[rectangle,inner sep=0.2em,fill=red!20] [fit = (neuron01) (neuron05)] (layer01)
{}
;
\end{pgfonlayer}
\node
[anchor=west] (layer00label) at ([xshift=1.2
em]x5.east)
{
输入层
}
;
\node
[anchor=west] (layer00label) at ([xshift=1.2
5em]x5.east)
{
\alert
{
输入层
}
}
;
\visible
<2->
{
\node
[anchor=west] (layer01label) at ([xshift=1em]layer01.east)
{
第
一
层
}
;
\node
[anchor=west] (layer01label) at ([xshift=1em]layer01.east)
{
第
二
层
}
;
}
\visible
<4->
{
\node
[anchor=west] (layer01label2) at (layer01label.east)
{
(
\alert
{
输入
层
}
)
}
;
\node
[anchor=west] (layer01label2) at (layer01label.east)
{
(
\alert
{
隐
层
}
)
}
;
}
%%% layer 2
\visible
<2->
{
\foreach
\n
in
{
2,...,4
}{
\node
[neuronnode] (neuron1
\n
) at (
\n
*
\neuronsep
,4em)
{}
;
\node
[neuronnode] (neuron1
\n
) at (
\n
*
\neuronsep
,4em)
{
\tiny
{$
f
_
2
$}
\\
[-1ex]
\tiny
{$
\sum
$}}
;
\draw
[-,ublue] (neuron1
\n
.east) -- (neuron1
\n
.west);
}
\foreach
\n
in
{
2,...,4
}{
...
...
@@ -454,7 +456,7 @@ cycle}
}
\end{pgfonlayer}
\node
[anchor=west] (layer02label) at ([xshift=4.9em]layer02.east)
{
第
二
层
}
;
\node
[anchor=west] (layer02label) at ([xshift=4.9em]layer02.east)
{
第
三
层
}
;
\visible
<4->
{
\node
[anchor=west] (layer02label2) at (layer02label.east)
{
(
\alert
{
隐层
}
)
}
;
}
...
...
@@ -463,7 +465,8 @@ cycle}
%%% layer 3
\visible
<3->
{
\foreach
\n
in
{
1,...,5
}{
\node
[neuronnode] (neuron2
\n
) at (
\n
*
\neuronsep
,8em)
{}
;
\node
[neuronnode] (neuron2
\n
) at (
\n
*
\neuronsep
,8em)
{
\tiny
{$
f
_
3
$}
\\
[-1ex]
\tiny
{$
\sum
$}}
;
\draw
[-,ublue] (neuron2
\n
.east) -- (neuron2
\n
.west);
}
\foreach
\n
in
{
1,...,5
}{
...
...
@@ -483,7 +486,7 @@ cycle}
}
\end{pgfonlayer}
\node
[anchor=west] (layer03label) at ([xshift=1em]layer03.east)
{
第
三
层
}
;
\node
[anchor=west] (layer03label) at ([xshift=1em]layer03.east)
{
第
四
层
}
;
\visible
<4->
{
\node
[anchor=west] (layer03label2) at (layer03label.east)
{
(
\alert
{
输出层
}
)
}
;
}
...
...
@@ -497,11 +500,77 @@ cycle}
%%%------------------------------------------------------------------------------------------------------------
%%% 两层神经网络可以逼近任何函数
\begin{frame}
{
多层神经网络
的函数逼近能力
}
\begin{frame}
{
多层神经网络
可以逼近任意函数
}
\begin{itemize}
\item
\textbf
{
单层神经网络
}
:线性变换 + 激活函数(非线性)
\item
我们可以重复上面的过程,构建
\textbf
{
多层神经网络
}
\item
以一个简单的两层网络为例(隐层激活函数:sigmoid)
\end{itemize}
\begin{center}
\begin{tikzpicture}
%% a two-layer neural network
\begin{scope}
\tikzstyle
{
neuronnode
}
= [minimum size=1.7em,circle,draw,ublue,very thick,inner sep=1pt, fill=white,align=center,drop shadow=
{
shadow xshift=0.1em,shadow yshift=-0.1em
}
]
%% input and hidden layers
\node
[neuronnode] (n10) at (0,0)
{
\tiny
{$
f
$}
\\
[-1ex]
\tiny
{$
\sum
$}}
;
\node
[neuronnode] (n11) at (1.5,0)
{
\tiny
{$
f
$}
\\
[-1ex]
\tiny
{$
\sum
$}}
;
\draw
[-,ublue] (n10.west) -- (n10.east);
\draw
[-,ublue] (n11.west) -- (n11.east);
\node
[anchor=north] (x1) at ([yshift=-6em]n11.south)
{$
x
_
1
$}
;
\node
[anchor=north] (b) at ([yshift=-6em]n10.south)
{$
b
$}
;
\draw
[->,thick,red] (b.north) -- ([yshift=-0.1em]n10.south);
\draw
[->,thick,blue] (b.north) -- ([yshift=-0.1em]n11.250);
\draw
[->,thick,ugreen] (x1.north) -- ([yshift=-0.1em]n10.290);
\draw
[->,thick,purple] (x1.north) -- ([yshift=-0.1em]n11.south);
%% output layers
\node
[neuronnode] (n20) at (0.75,5em)
{
\scriptsize
{$
\sum
$}}
;
\draw
[->,thick] ([yshift=0.1em]n10.north) -- ([yshift=-0.1em]n20.250);
\draw
[->,thick] ([yshift=0.1em]n11.north) -- ([yshift=-0.1em]n20.290);
\node
[] (y) at ([yshift=3em]n20.north)
{$
y
$}
;
\draw
[->,thick] ([yshift=0.1em]n20.north) -- (y.south);
%% weight and bias
\node
[anchor=center,rotate=90] (b0) at ([yshift=3em,xshift=-0.5em]b.north)
{
\tiny
{$
b
=
0
$}}
;
\node
[anchor=center,rotate=59,fill=white,inner sep=1pt] (b1) at ([yshift=4.9em,xshift=2.2em]b.north)
{
\tiny
{$
b
=
0
$}}
;
\node
[anchor=center,rotate=90] (w1) at ([yshift=3em,xshift=0.5em]x1.north)
{
\tiny
{$
w
=
1
$}}
;
\node
[anchor=center,rotate=-59,fill=white,inner sep=1pt] (w2) at ([yshift=1.2em,xshift=-1.2em]x1.north)
{
\tiny
{$
w
=
0
$}}
;
\node
[anchor=center,rotate=62,fill=white,inner sep=1pt] (w21) at ([yshift=2em,xshift=0.5em]n10.north)
{
\tiny
{$
w
=
0
$}}
;
\node
[anchor=center,rotate=-62,fill=white,inner sep=1pt] (w22) at ([yshift=2em,xshift=-0.5em]n11.north)
{
\tiny
{$
w
=
0
$}}
;
\begin{scope}
\node
[anchor=west] (flabel) at ([xshift=1.2in]y.east)
{
\footnotesize
{
sigmoid:
}}
;
\node
[anchor=west,inner sep=2pt] (flabel2) at (flabel.east)
{
\footnotesize
{$
f
(
x
)=
1
/(
1
+
e
^{
-
x
}
)
$}}
;
\node
[anchor=north west,inner sep=2pt] (flabel3) at (flabel2.south west)
{
\footnotesize
{$
s
=
x
_
1
\cdot
w
+
b
$}}
;
\draw
[->,thick,dotted] ([yshift=-0.3em,xshift=-0.1em]n11.60) .. controls +(east:1) and +(west:2) .. ([xshift=-0.2em]flabel.west) ;
\begin{pgfonlayer}
{
background
}
\node
[rectangle,inner sep=0.2em,fill=blue!20,drop shadow=
{
shadow xshift=0.1em,shadow yshift=-0.1em
}
] [fit = (flabel) (flabel2) (flabel3)] (funcbox)
{}
;
\end{pgfonlayer}
\end{scope}
\begin{scope}
[xshift=2.8in,yshift=0.2in]
\draw
[->,thick] (-2,0) -- (2,0);
\draw
[->,thick] (0,0) -- (0,2);
\draw
[-] (-0.05,1) -- (0.05,1);
\node
[anchor=east,inner sep=1pt] (label1) at (0,1)
{
\tiny
{
1
}}
;
\node
[anchor=south east,inner sep=1pt] (label2) at (0,0)
{
\tiny
{
0
}}
;
\draw
[-,very thick,ublue,domain=-2:2,samples=100] plot (
\x
,
{
1/(1+exp(-2*
\x
))
}
);
\draw
[-,very thick,ublue,domain=-2:2,samples=100] plot (
\x
,
{
1/(1+exp(-4*
\x
))
}
);
\draw
[-,very thick,ublue,rounded corners=0.2em] (-2,0) -- (0,0) -- (0,1) -- (2,1);
\draw
[-,very thick,ublue,rounded corners=0.2em] (-2,0) -- (0.25,0) -- (0.25,1) -- (2,1);
\draw
[-,very thick,ublue,rounded corners=0.2em] (-2,0) -- (0.5,0) -- (0.5,1) -- (2,1);
\node
[anchor=north west,align=left] (wblabel) at (-2,2)
{
\scriptsize
{$
w
_
1
=
1
$}
\\
[-0ex]
\scriptsize
{
\
$
b
_
1
=
0
$}}
;
\end{scope}
\end{scope}
\end{tikzpicture}
\end{center}
\end{frame}
%%%------------------------------------------------------------------------------------------------------------
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论