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
11ca61d7
Commit
11ca61d7
authored
Sep 17, 2019
by
xiaotong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new page
parent
395b992b
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
230 行增加
和
7 行删除
+230
-7
Section05-Neural-Networks-and-Language-Modeling/Figures/wf.png
+0
-0
Section05-Neural-Networks-and-Language-Modeling/section05-test.tex
+228
-5
Section05-Neural-Networks-and-Language-Modeling/section05.tex
+2
-2
没有找到文件。
Section05-Neural-Networks-and-Language-Modeling/Figures/wf.png
0 → 100644
查看文件 @
11ca61d7
46.1 KB
Section05-Neural-Networks-and-Language-Modeling/section05-test.tex
查看文件 @
11ca61d7
...
@@ -111,6 +111,8 @@
...
@@ -111,6 +111,8 @@
\item
对于向量
$
\textbf
{
x
}
\in
\mathbb
{
R
}^
m
$
,一层神经网络首先把他经过
\textbf
{
\alert
{
线性变换
}}
映射到
$
\mathbb
{
R
}^
m
$
,之后经过
\textbf
{{
\color
{
blue
}
激活函数
}}
变换成
$
\textbf
{
y
}
\in
\mathbb
{
R
}^
n
$
\item
对于向量
$
\textbf
{
x
}
\in
\mathbb
{
R
}^
m
$
,一层神经网络首先把他经过
\textbf
{
\alert
{
线性变换
}}
映射到
$
\mathbb
{
R
}^
m
$
,之后经过
\textbf
{{
\color
{
blue
}
激活函数
}}
变换成
$
\textbf
{
y
}
\in
\mathbb
{
R
}^
n
$
\end{itemize}
\end{itemize}
\vspace
{
1em
}
\begin{center}
\begin{center}
\begin{tikzpicture}
\begin{tikzpicture}
...
@@ -136,10 +138,19 @@
...
@@ -136,10 +138,19 @@
\end{pgfonlayer}
\end{pgfonlayer}
\end{tikzpicture}
\end{tikzpicture}
\end{center}
\begin{figure}
[htp!]
\includegraphics
[scale=0.24]
{
./Figures/wf.png
}
% \begin{tikzpicture}
% \node [rectangle,inner sep=0.2em,fill=red!20] [fit = (x) (w) (b)] (linear) {};
% \node [anchor=north] (linearlabel) at ([yshift=-1.1em]linear.south) {\alert{线性变换}}
\end{figure}
\tikz
{
\node
() at (0,0)
{}
;
\node
() at (0,10)
{}
;
}
\end{center}
\end{frame}
\end{frame}
%%%------------------------------------------------------------------------------------------------------------
%%%------------------------------------------------------------------------------------------------------------
%%% 线性变换
%%% 线性变换
\begin{frame}
{
线性变换
}
\begin{frame}
{
线性变换
}
...
@@ -152,7 +163,7 @@ T(\alpha \textbf{a}) & = & \alpha T(\textbf{a}) \nonumber
...
@@ -152,7 +163,7 @@ T(\alpha \textbf{a}) & = & \alpha T(\textbf{a}) \nonumber
\item
<2-> 线性变换的一种几何解释:
\item
<2-> 线性变换的一种几何解释:
\end{itemize}
\end{itemize}
\vspace
{
-
1
em
}
\vspace
{
-
0.5
em
}
\visible
<2->
{
\visible
<2->
{
\begin{center}
\begin{center}
\begin{tikzpicture}
\begin{tikzpicture}
...
@@ -163,32 +174,133 @@ T(\alpha \textbf{a}) & = & \alpha T(\textbf{a}) \nonumber
...
@@ -163,32 +174,133 @@ T(\alpha \textbf{a}) & = & \alpha T(\textbf{a}) \nonumber
\node
[anchor=west] (plus) at (w.east)
{
\Large
{$
+
$}}
;
\node
[anchor=west] (plus) at (w.east)
{
\Large
{$
+
$}}
;
\node
[anchor=west] (b) at (plus.east)
{
\Large
{$
\textbf
{
b
}$}}
;
\node
[anchor=west] (b) at (plus.east)
{
\Large
{$
\textbf
{
b
}$}}
;
\tikzstyle
{
neuron
}
= [rectangle,draw,thick,fill=red!30,red!35,minimum height=2em,minimum width=2em,font=
\small
]
\node
[neuron,anchor=north]
(a1) at ([xshift=-6em,yshift=-4em]x.south)
{}
;
\draw
[->,thick]
([xshift=-2em,yshift=0em]a1.south) to ([xshift=3em,yshift=0em]a1.south);
\draw
[->,thick]
([xshift=0em,yshift=-4em]a1.west) to ([xshift=0em,yshift=2em]a1.west);
\node
[below]
at ([xshift=0.5em,yshift=-1em]a1.west)
{
0
}
;
\node
[below]
at ([xshift=2em,yshift=-1em]a1.west)
{
1
}
;
\node
[below]
at ([xshift=-0.5em,yshift=2em]a1.west)
{
1
}
;
\node
[anchor=west] (x) at ([xshift=-0.7em,yshift=1em]a1.south)
{
\Large
{$
\textbf
{
F
}$}}
;
\visible
<3->
{
\visible
<3->
{
\node
[anchor=center,fill=green!20] (w2) at (w)
{
\Large
{$
\textbf
{
w
}$}}
;
\node
[anchor=center,fill=green!20] (w2) at (w)
{
\Large
{$
\textbf
{
w
}$}}
;
\node
[anchor=north,inner sep=1pt] (wlabel) at ([yshift=-0.7em]w.south)
{
\small
{
旋转(rotation)
}}
;
\node
[anchor=north,inner sep=1pt] (wlabel) at ([yshift=-0.7em]w.south)
{
\small
{
旋转(rotation)
}}
;
\draw
[<-] ([yshift=-0.2em]w2.south) -- (wlabel.north);
\draw
[<-] ([yshift=-0.2em]w2.south) -- (wlabel.north);
\tikzstyle
{
neuron
}
= [rectangle,draw,thick,fill=red!30,red!35,minimum height=2em,minimum width=2em,font=
\small
]
\node
[neuron,anchor=north]
(a2) at ([xshift=10em,yshift=0em]a1.south)
{}
;
\draw
[->,thick]
([xshift=-2em,yshift=0em]a2.north) to ([xshift=3em,yshift=0em]a2.north);
\draw
[->,thick]
([xshift=0em,yshift=-2em]a2.west) to ([xshift=0em,yshift=4em]a2.west);
\node
[above]
at ([xshift=0.5em,yshift=1em]a2.west)
{
0
}
;
\node
[above]
at ([xshift=2em,yshift=1em]a2.west)
{
1
}
;
\node
[below]
at ([xshift=-0.5em,yshift=0em]a2.west)
{
-1
}
;
\node
[anchor=west] (x) at ([xshift=-3.5cm,yshift=2em]a2.north)
{
\scriptsize
{
$
w
=
\begin
{
bmatrix
}
1
&
0
&
0
\\
0
&
-
1
&
0
\\
0
&
0
&
1
\end
{
bmatrix
}$}
}
;
\node
[anchor=west,rotate = 180] (x) at ([xshift=0.7em,yshift=1em]a2.south)
{
\Large
{$
\textbf
{
F
}$}}
;
\draw
[-stealth, line width=2pt,dashed]
([xshift=4em,yshift=0em]a1.south) to ([xshift=-3em,yshift=0em]a2.north);
}
}
\visible
<4->
{
\visible
<4->
{
\node
[anchor=center,fill=purple!20] (b2) at (b)
{
\Large
{$
\textbf
{
b
}$}}
;
\node
[anchor=center,fill=purple!20] (b2) at (b)
{
\Large
{$
\textbf
{
b
}$}}
;
\node
[anchor=west] (blabel) at ([xshift=1.5em]b2.east)
{
平移(shift)
}
;
\node
[anchor=west] (blabel) at ([xshift=1.5em]b2.east)
{
平移(shift)
}
;
\draw
[<-] ([xshift=0.2em]b2.east) -- (blabel.west);
\draw
[<-] ([xshift=0.2em]b2.east) -- (blabel.west);
\tikzstyle
{
neuron
}
= [rectangle,draw,thick,fill=red!30,red!35,minimum height=2em,minimum width=2em,font=
\small
]
\node
[neuron,anchor=north]
(a3) at ([xshift=11em,yshift=2.05em]a2.south)
{}
;
\draw
[->,thick]
([xshift=-3em,yshift=0em]a3.north) to ([xshift=2em,yshift=0em]a3.north);
\draw
[->,thick]
([xshift=-1em,yshift=-2em]a3.west) to ([xshift=-1em,yshift=4em]a3.west);
\node
[above]
at ([xshift=-0.5em,yshift=1em]a3.west)
{
0
}
;
\node
[above]
at ([xshift=1em,yshift=1em]a3.west)
{
1
}
;
\node
[left]
at ([xshift=-0.75em,yshift=-0.5em]a3.west)
{
-1
}
;
\node
[anchor=west,rotate = 180] (x) at ([xshift=0.7em,yshift=1em]a3.south)
{
\Large
{$
\textbf
{
F
}$}}
;
\node
[anchor=west] (x) at ([xshift=-4cm,yshift=2em]a3.north)
{
\scriptsize
{
$
b
=
\begin
{
bmatrix
}
0
.
5
&
0
&
0
\\
0
&
0
&
0
\\
0
&
0
&
0
\end
{
bmatrix
}$}
}
;
\draw
[-stealth, line width=2pt,dashed]
([xshift=3em,yshift=1em]a2.east) to ([xshift=-3em,yshift=1em]a3.west);
}
}
\end{tikzpicture}
\end{tikzpicture}
\end{center}
\end{center}
}
}
\end{frame}
\end{frame}
%%%------------------------------------------------------------------------------------------------------------
%%%------------------------------------------------------------------------------------------------------------
%%% 线性变换:更复杂的实例
%%% 线性变换:更复杂的实例
\begin{frame}
{
线性变换(续)
}
\begin{frame}
[fragile]
{
线性变换(续)
}
\begin{itemize}
\begin{itemize}
\item
线性变换也适用于更加复杂的情况,这也给神经网络提供了拟合不同数据分布的能力
\item
线性变换也适用于更加复杂的情况,这也给神经网络提供了拟合不同数据分布的能力
\begin{itemize}
\item
比如,我们可以把三维图形投影到二维平面上
\item
再比如,我们也可以把二维平面上的图形映射到三维平面上
\end{itemize}
\end{itemize}
\end{itemize}
\vspace
{
1em
}
\newcommand
{
\plane
}
[1]
{
(-1.95, #1, 1.35) --
++(3.6, 0.6, 0.0) --
++(0.3, -1.8, -2.7) --
++(-3.6, -0.6, -0.0) --
cycle
}
\newcommand
{
\nullspacepicture
}{
% bottom part of the row space line
\draw
(0,0,0) -- (0.3,-1.8,1.233);
% five planes
\draw
[fill=gray!20]
\plane
{
-0.2
}
;
\draw
[fill=gray!20]
\plane
{
0.2
}
;
\draw
[fill=blue!70!gray]
\plane
{
0.6
}
;
\draw
[fill=gray!20]
\plane
{
1
}
;
\draw
[fill=gray!20]
\plane
{
1.4
}
;
% top part of the row space line
\draw
(-.094,.562,-.385) -- (-0.3,1.8,-1.233);
}
\newcommand
{
\rangepicture
}
[1]
{
% axes
\draw
[help lines,->]
(-2,0) -- (2,0);
\draw
[help lines,->]
(0,-2) -- (0,2);
% the line and circles
\draw
(1,-2) -- (-1,2);
\draw
[fill=#1]
(0,0) circle (2.5pt);
\draw
[fill=gray!50]
(0.2,-0.4) circle (2.5pt);
\draw
[fill=gray!50]
(0.4,-0.8) circle (2.5pt);
\draw
[fill=gray!50]
(-0.2,0.4) circle (2.5pt);
\draw
[fill=gray!50]
(-0.4,0.8) circle (2.5pt);
}
\begin{tikzpicture}
[scale=0.95]
\centering
\nullspacepicture
% the label
\node
at (-2,1.8)
{$
\mathbb
{
R
}^
3
$}
;
% arrow between diagrams
\path
[->]
(3,0) edge[bend left] node[above]
{
线性变换
}
(4.5,0);
\begin{scope}
[xshift=7cm]
\rangepicture
{
blue!70!gray
}
\node
at (1.8,1.8)
{$
\mathbb
{
R
}^
2
$}
;
\end{scope}
\end{tikzpicture}
\end{frame}
\end{frame}
%%%------------------------------------------------------------------------------------------------------------
%%%------------------------------------------------------------------------------------------------------------
%%% 激活函数
%%% 激活函数
\begin{frame}
{
激活函数
}
\begin{frame}
{
激活函数
}
...
@@ -237,10 +349,10 @@ T(\alpha \textbf{a}) & = & \alpha T(\textbf{a}) \nonumber
...
@@ -237,10 +349,10 @@ T(\alpha \textbf{a}) & = & \alpha T(\textbf{a}) \nonumber
\begin{scope}
[xshift=9.5em]
\begin{scope}
[xshift=9.5em]
\draw
[->,thick] (-1.5,0) -- (1.5,0);
\draw
[->,thick] (-1.5,0) -- (1.5,0);
\draw
[->,thick] (0,-0.1) -- (0,1.5);
\draw
[->,thick] (0,-0.1) -- (0,1.5);
\draw
[-,very thick,ublue,domain=-1.2:1.2,samples=100] plot (
\x
,
{
0.5
*2
^
\x
}
);
\draw
[-,very thick,ublue,domain=-1.2:1.2,samples=100] plot (
\x
,
{
0.5
* exp(
\x
)
}
);
\node
[anchor=west] (ylabel) at (0,1.3)
{$
y
$}
;
\node
[anchor=west] (ylabel) at (0,1.3)
{$
y
$}
;
\node
[anchor=north] (xlabel) at (1.3,0)
{$
x
$}
;
\node
[anchor=north] (xlabel) at (1.3,0)
{$
x
$}
;
\node
[anchor=north] (func) at (0,-0.8)
{
\footnotesize
{$
y
=
0
.
5
\cdot
2
^
x
$}}
;
\node
[anchor=north] (func) at (0,-0.8)
{
\footnotesize
{$
y
=
0
.
5
\cdot
\exp
(
x
)
$}}
;
\node
[anchor=south west] (flabel) at ([xshift=-1.8em]func.north west)
{
\footnotesize
{
Exponential:
}}
;
\node
[anchor=south west] (flabel) at ([xshift=-1.8em]func.north west)
{
\footnotesize
{
Exponential:
}}
;
\end{scope}
\end{scope}
...
@@ -271,6 +383,117 @@ T(\alpha \textbf{a}) & = & \alpha T(\textbf{a}) \nonumber
...
@@ -271,6 +383,117 @@ T(\alpha \textbf{a}) & = & \alpha T(\textbf{a}) \nonumber
\subsection
{
多层神经网络
}
\subsection
{
多层神经网络
}
%%%------------------------------------------------------------------------------------------------------------
%%%------------------------------------------------------------------------------------------------------------
%%% 一层 -> 多层
\begin{frame}
{
更多的层
}
\begin{itemize}
\item
\textbf
{
单层神经网络
}
:线性变换 + 激活函数(非线性)
\item
我们可以重复上面的过程,构建
\textbf
{
多层神经网络
}
\end{itemize}
\vspace
{
-0.5em
}
\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
}
]
%%% layer 1
\foreach
\n
in
{
1,...,5
}{
\node
[neuronnode] (neuron0
\n
) at (
\n
*
\neuronsep
,0)
{}
;
}
\foreach
\n
in
{
1,...,5
}{
\foreach
\m
in
{
1,...,5
}{
\draw
[<-] (neuron0
\m
.south) -- ([yshift=-2em]neuron0
\n
.south);
}
\node
[anchor=north] (x
\n
) at ([yshift=-2em]neuron0
\n
.south)
{$
x
_
\n
$}
;
\visible
<1>
{
\draw
[<-,thick] ([yshift=1.5em]neuron0
\n
.north) -- (neuron0
\n
.north);
\node
[anchor=south] (y
\n
) at ([yshift=1.5em]neuron0
\n
.north)
{$
y
_
\n
$}
;
}
}
\node
[anchor=west] (w1label) at ([xshift=-0.5em,yshift=0.5em]x5.north east)
{$
\textbf
{
w
}_
1
$}
;
\begin{pgfonlayer}
{
background
}
\node
[rectangle,inner sep=0.2em,fill=red!20] [fit = (neuron01) (neuron05)] (layer01)
{}
;
\end{pgfonlayer}
\visible
<2->
{
\node
[anchor=west] (layer01label) at ([xshift=1em]layer01.east)
{
第一层
}
;
}
\visible
<4->
{
\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)
{}
;
}
\foreach
\n
in
{
2,...,4
}{
\foreach
\m
in
{
1,...,5
}{
\draw
[<-] (neuron1
\n
.south) -- (neuron0
\m
.north);
}
\visible
<2>
{
\draw
[<-,thick] ([yshift=1.5em]neuron1
\n
.north) -- (neuron1
\n
.north);
\node
[anchor=south] (y
\n
) at ([yshift=1.5em]neuron1
\n
.north)
{$
y
_
\n
$}
;
}
}
\node
[anchor=west] (w2label) at ([xshift=-2.5em,yshift=5.0em]x5.north east)
{$
\textbf
{
w
}_
2
$}
;
\begin{pgfonlayer}
{
background
}
\visible
<2->
{
\node
[rectangle,inner sep=0.2em,fill=ugreen!20] [fit = (neuron12) (neuron14)] (layer02)
{}
;
}
\end{pgfonlayer}
\node
[anchor=west] (layer02label) at ([xshift=4.9em]layer02.east)
{
第二层
}
;
\visible
<4->
{
\node
[anchor=west] (layer02label2) at (layer02label.east)
{
(
\alert
{
隐层
}
)
}
;
}
}
%%% layer 3
\visible
<3->
{
\foreach
\n
in
{
1,...,5
}{
\node
[neuronnode] (neuron2
\n
) at (
\n
*
\neuronsep
,8em)
{}
;
}
\foreach
\n
in
{
1,...,5
}{
\foreach
\m
in
{
2,...,4
}{
\draw
[<-] (neuron2
\n
.south) -- (neuron1
\m
.north);
}
\node
[anchor=south] (y
\n
) at ([yshift=1.5em]neuron2
\n
.north)
{$
y
_
\n
$}
;
\draw
[<-,thick] ([yshift=1.5em]neuron2
\n
.north) -- (neuron2
\n
.north);
}
\node
[anchor=west] (w3label) at ([xshift=-2.5em,yshift=8.5em]x5.north east)
{$
\textbf
{
w
}_
3
$}
;
\begin{pgfonlayer}
{
background
}
\visible
<3->
{
\node
[rectangle,inner sep=0.2em,fill=blue!20] [fit = (neuron21) (neuron25)] (layer03)
{}
;
}
\end{pgfonlayer}
\node
[anchor=west] (layer03label) at ([xshift=1em]layer03.east)
{
第三层
}
;
\visible
<4->
{
\node
[anchor=west] (layer03label2) at (layer03label.east)
{
(
\alert
{
输出层
}
)
}
;
}
}
\end{scope}
\end{tikzpicture}
\end{center}
\end{frame}
%%%------------------------------------------------------------------------------------------------------------
\subsection
{
参数学习 - 反向传播
}
\subsection
{
参数学习 - 反向传播
}
\end{CJK}
\end{CJK}
...
...
Section05-Neural-Networks-and-Language-Modeling/section05.tex
查看文件 @
11ca61d7
...
@@ -991,10 +991,10 @@ T(\alpha \textbf{a}) & = & \alpha T(\textbf{a}) \nonumber
...
@@ -991,10 +991,10 @@ T(\alpha \textbf{a}) & = & \alpha T(\textbf{a}) \nonumber
\begin{scope}
[xshift=9.5em]
\begin{scope}
[xshift=9.5em]
\draw
[->,thick] (-1.5,0) -- (1.5,0);
\draw
[->,thick] (-1.5,0) -- (1.5,0);
\draw
[->,thick] (0,-0.1) -- (0,1.5);
\draw
[->,thick] (0,-0.1) -- (0,1.5);
\draw
[-,very thick,ublue,domain=-1.2:1.2,samples=100] plot (
\x
,
{
0.5
*2
^
\x
}
);
\draw
[-,very thick,ublue,domain=-1.2:1.2,samples=100] plot (
\x
,
{
0.5
* exp(
\x
)
}
);
\node
[anchor=west] (ylabel) at (0,1.3)
{$
y
$}
;
\node
[anchor=west] (ylabel) at (0,1.3)
{$
y
$}
;
\node
[anchor=north] (xlabel) at (1.3,0)
{$
x
$}
;
\node
[anchor=north] (xlabel) at (1.3,0)
{$
x
$}
;
\node
[anchor=north] (func) at (0,-0.8)
{
\footnotesize
{$
y
=
0
.
5
\cdot
2
^
x
$}}
;
\node
[anchor=north] (func) at (0,-0.8)
{
\footnotesize
{$
y
=
0
.
5
\cdot
\exp
(
x
)
$}}
;
\node
[anchor=south west] (flabel) at ([xshift=-1.8em]func.north west)
{
\footnotesize
{
Exponential:
}}
;
\node
[anchor=south west] (flabel) at ([xshift=-1.8em]func.north west)
{
\footnotesize
{
Exponential:
}}
;
\end{scope}
\end{scope}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论