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
NiuTrans
Toy-MT-Introduction
Commits
4638e81f
Commit
4638e81f
authored
May 06, 2020
by
zengxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chapter 5 figures
parent
dccbabf2
显示空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
45 行增加
和
45 行删除
+45
-45
Book/Chapter5/Figures/fig-4-gram.tex
+11
-11
Book/Chapter5/Figures/fig-code-back-propagation-2.tex
+4
-4
Book/Chapter5/Figures/fig-four-layers-of-neural-network.tex
+1
-1
Book/Chapter5/Figures/fig-gaussian.tex
+3
-3
Book/Chapter5/Figures/fig-identity.tex
+3
-3
Book/Chapter5/Figures/fig-relu.tex
+3
-3
Book/Chapter5/Figures/fig-sigmoid.tex
+3
-3
Book/Chapter5/Figures/fig-softplus.tex
+3
-3
Book/Chapter5/Figures/fig-tanh.tex
+3
-3
Book/Chapter5/Figures/fig-two-layer-neural-network.tex
+6
-6
Book/Chapter5/chapter5.tex
+4
-4
Book/mt-book-xelatex.tex
+1
-1
没有找到文件。
Book/Chapter5/Figures/fig-4-gram.tex
查看文件 @
4638e81f
...
...
@@ -14,19 +14,19 @@
\node
[anchor=south,draw,minimum width=9em,inner sep=3pt] (h1) at ([yshift=1.5em]h0.north)
{
\tiny
{$
\textbf
{
y
}
=
\textrm
{
Softmax
}
(
\textbf
{
h
}_
0
\textbf
{
U
}
)
$}}
;
\node
[anchor=south] (ylabel) at ([yshift=1em]h1.north)
{
\footnotesize
{$
\textrm
{
P
}
(
w
_
i|w
_{
i
-
3
}
w
_{
i
-
2
}
w
_{
i
-
1
}
)
$}}
;
\draw
[->] ([yshift=0.1em]w0.north) -- ([yshift=-0.1em]e0.south);
\draw
[->] ([yshift=0.1em]w1.north) -- ([yshift=-0.1em]e1.south);
\draw
[->] ([yshift=0.1em]w2.north) -- ([yshift=-0.1em]e2.south);
\draw
[->] ([yshift=0.1em]e0.north) -- ([xshift=-2em,yshift=-0.1em]h0.south);
\draw
[->] ([yshift=0.1em]e1.north) -- ([yshift=-0.1em]h0.south);
\draw
[->] ([yshift=0.1em]e2.north) -- ([xshift=2em,yshift=-0.1em]h0.south);
\draw
[->] ([yshift=0.1em]h0.north) -- ([yshift=-0.1em]h1.south);
\draw
[->] ([yshift=0.1em]h1.north) -- ([yshift=-0.1em]ylabel.south);
\draw
[->
,line width=1pt
] ([yshift=0.1em]w0.north) -- ([yshift=-0.1em]e0.south);
\draw
[->
,line width=1pt
] ([yshift=0.1em]w1.north) -- ([yshift=-0.1em]e1.south);
\draw
[->
,line width=1pt
] ([yshift=0.1em]w2.north) -- ([yshift=-0.1em]e2.south);
\draw
[->
,line width=1pt
] ([yshift=0.1em]e0.north) -- ([xshift=-2em,yshift=-0.1em]h0.south);
\draw
[->
,line width=1pt
] ([yshift=0.1em]e1.north) -- ([yshift=-0.1em]h0.south);
\draw
[->
,line width=1pt
] ([yshift=0.1em]e2.north) -- ([xshift=2em,yshift=-0.1em]h0.south);
\draw
[->
,line width=1pt
] ([yshift=0.1em]h0.north) -- ([yshift=-0.1em]h1.south);
\draw
[->
,line width=1pt
] ([yshift=0.1em]h1.north) -- ([yshift=-0.1em]ylabel.south);
{
\draw
[->,dashed,red,
thick
] ([xshift=1em,yshift=0.1em]e1.north) -- ([xshift=1em,yshift=-0.1em]h1.south);
\draw
[->,dashed,red,
thick
] ([xshift=-1em,yshift=0.1em]e0.north) .. controls +(north:2) and +(south:1) .. ([xshift=-3em,yshift=-0.1em]h1.south);
\draw
[->,dashed,red,
thick
] ([xshift=1em,yshift=0.1em]e2.north) .. controls +(north:2) and +(south:1) .. ([xshift=3em,yshift=-0.1em]h1.south);
\draw
[->,dashed,red,
line width=1pt
] ([xshift=1em,yshift=0.1em]e1.north) -- ([xshift=1em,yshift=-0.1em]h1.south);
\draw
[->,dashed,red,
line width=1pt
] ([xshift=-1em,yshift=0.1em]e0.north) .. controls +(north:2) and +(south:1) .. ([xshift=-3em,yshift=-0.1em]h1.south);
\draw
[->,dashed,red,
line width=1pt
] ([xshift=1em,yshift=0.1em]e2.north) .. controls +(north:2) and +(south:1) .. ([xshift=3em,yshift=-0.1em]h1.south);
}
\begin{pgfonlayer}
{
background
}
...
...
Book/Chapter5/Figures/fig-code-back-propagation-2.tex
查看文件 @
4638e81f
...
...
@@ -35,14 +35,14 @@
\node
[anchor=south,draw,rounded corners,inner sep=2pt,minimum width=8em,minimum height=1.0em,fill=green!30!white,blur shadow=
{
shadow xshift=1pt,shadow yshift=-1pt
}
] (h3) at ([yshift=1.0em]h2.north)
{
\tiny
{
h2 = Relu(h1 * w2 + b2)
}}
;
\node
[anchor=south,draw,rounded corners,inner sep=2pt,minimum width=8em,minimum height=1.0em,fill=green!30!white,blur shadow=
{
shadow xshift=1pt,shadow yshift=-1pt
}
] (h4) at ([yshift=1.0em]h3.north)
{
\tiny
{
h3 = HardTanh(h2)
}}
;
\draw
[->,thick] (h1.north) -- (h2.south);
\draw
[->,thick] (h2.north) -- (h3.south);
\draw
[->,thick] (h3.north) -- (h4.south);
\draw
[->,
very
thick] (h1.north) -- (h2.south);
\draw
[->,
very
thick] (h2.north) -- (h3.south);
\draw
[->,
very
thick] (h3.north) -- (h4.south);
\node
[anchor=south,draw,rounded corners,inner sep=2pt,minimum width=8.0em,minimum height=1.0em,fill=red!30!white,blur shadow=
{
shadow xshift=1pt,shadow yshift=-1pt
}
] (slayer) at ([yshift=1.0em]h4.north)
{
\tiny
{
h4 = Softmax(h3 * w4) (output)
}}
;
\node
[anchor=south] (losslabel) at (slayer.north)
{
\scriptsize
{
\textbf
{
Cross Entropy Loss
}}}
;
\draw
[->,thick] (h4.north) -- (slayer.south);
\draw
[->,
very
thick] (h4.north) -- (slayer.south);
\end{tikzpicture}
\end{center}
...
...
Book/Chapter5/Figures/fig-four-layers-of-neural-network.tex
查看文件 @
4638e81f
...
...
@@ -55,7 +55,7 @@
}
\end{pgfonlayer}
\node
[anchor=west] (layer02label) at ([xshift=4.
5
em]layer02.east)
{
\footnotesize
{
第三层
}}
;
\node
[anchor=west] (layer02label) at ([xshift=4.
4
em]layer02.east)
{
\footnotesize
{
第三层
}}
;
{
\node
[anchor=west] (layer02label2) at (layer02label.east)
{
\footnotesize
{
\red
{
(
{
隐层
}
)
}}}
;
}
...
...
Book/Chapter5/Figures/fig-gaussian.tex
查看文件 @
4638e81f
%%%------------------------------------------------------------------------------------------------------------
\begin{tikzpicture}
\draw
[->]
(-1.2,0)--(1.2,0)node[left,below,font=
\tiny
]
{$
x
$}
;
\draw
[->]
(0,-1.2)--(0,1.2)node[right,font=
\tiny
]
{$
y
$}
;
\draw
[->
, line width=1pt
]
(-1.2,0)--(1.2,0)node[left,below,font=
\tiny
]
{$
x
$}
;
\draw
[->
, line width=1pt
]
(0,-1.2)--(0,1.2)node[right,font=
\tiny
]
{$
y
$}
;
\draw
[dashed]
(-1.2,1)--(1.2,1);
\foreach
\x
in
{
-1.0,-0.5,0.0,0.5,1.0
}{
\draw
(
\x
,0)--(
\x
,0.05)node[below,outer sep=2pt,font=
\tiny
]at(
\x
,0)
{
\x
}
;
}
\foreach
\y
in
{
0.5,1.0
}{
\draw
(0,
\y
)--(0.05,
\y
)node[left,outer sep=2pt,font=
\tiny
]at(0,
\y
)
{
\y
}
;
}
\draw
[color=red ,domain=-1.2:1.2]
plot(
\x
,
{
exp(-1*((
\x
)
^
2))
}
);
\draw
[color=red ,domain=-1.2:1.2
, line width=1pt
]
plot(
\x
,
{
exp(-1*((
\x
)
^
2))
}
);
\node
[black,anchor=south]
at (0,1.2)
{
\small
$
y
=
e
^{
-
x
^
2
}$}
;
\end{tikzpicture}
%%%------------------------------------------------------------------------------------------------------------
...
...
Book/Chapter5/Figures/fig-identity.tex
查看文件 @
4638e81f
%%%------------------------------------------------------------------------------------------------------------
\begin{tikzpicture}
\draw
[->]
(-1.2,0)--(1.2,0)node[left,below,font=
\tiny
]
{$
x
$}
;
\draw
[->]
(0,-1.2)--(0,1.2)node[right,font=
\tiny
]
{$
y
$}
;
\draw
[->
, line width=1pt
]
(-1.2,0)--(1.2,0)node[left,below,font=
\tiny
]
{$
x
$}
;
\draw
[->
, line width=1pt
]
(0,-1.2)--(0,1.2)node[right,font=
\tiny
]
{$
y
$}
;
\foreach
\x
in
{
-1.0,-0.5,0.0,0.5,1.0
}{
\draw
(
\x
,0)--(
\x
,0.05)node[below,outer sep=2pt,font=
\tiny
]at(
\x
,0)
{
\x
}
;
}
\foreach
\y
in
{
0.5,1.0
}{
\draw
(0,
\y
)--(0.05,
\y
)node[left,outer sep=2pt,font=
\tiny
]at(0,
\y
)
{
\y
}
;
}
\draw
[color=red ,domain=-1:1]
plot(
\x
,
\x
);
\draw
[color=red ,domain=-1:1
, line width=1pt
]
plot(
\x
,
\x
);
\node
[black,anchor=south]
at (0,1.2)
{
\small
$
y
=
x
$}
;
\end{tikzpicture}
%%%------------------------------------------------------------------------------------------------------------
...
...
Book/Chapter5/Figures/fig-relu.tex
查看文件 @
4638e81f
%%%------------------------------------------------------------------------------------------------------------
\begin{tikzpicture}
\draw
[->]
(-1.2,0)--(1.2,0)node[left,below,font=
\tiny
]
{$
x
$}
;
\draw
[->]
(0,-1.2)--(0,1.2)node[right,font=
\tiny
]
{$
y
$}
;
\draw
[->
, line width=1pt
]
(-1.2,0)--(1.2,0)node[left,below,font=
\tiny
]
{$
x
$}
;
\draw
[->
, line width=1pt
]
(0,-1.2)--(0,1.2)node[right,font=
\tiny
]
{$
y
$}
;
\draw
[dashed]
(-1.2,1)--(1.2,1);
\draw
[dashed]
(-1.2,-1)--(1.2,-1);
\foreach
\x
in
{
-1.0,-0.5,0.0,0.5,1.0
}{
\draw
(
\x
,0)--(
\x
,0.05)node[below,outer sep=2pt,font=
\tiny
]at(
\x
,0)
{
\x
}
;
}
\foreach
\y
in
{
0.5,1.0
}{
\draw
(0,
\y
)--(0.05,
\y
)node[left,outer sep=2pt,font=
\tiny
]at(0,
\y
)
{
\y
}
;
}
\draw
[color=red ,domain=-1.2:1.2]
plot(
\x
,
{
max(
\x
,0)
}
);
\draw
[color=red ,domain=-1.2:1.2
, line width=1pt
]
plot(
\x
,
{
max(
\x
,0)
}
);
\node
[black,anchor=south]
at (0,1.2)
{
\small
$
y
=
\max
(
0
, x
)
$}
;
\end{tikzpicture}
%%%------------------------------------------------------------------------------------------------------------
...
...
Book/Chapter5/Figures/fig-sigmoid.tex
查看文件 @
4638e81f
%%%------------------------------------------------------------------------------------------------------------
\begin{tikzpicture}
\draw
[->]
(-1.2,0)--(1.2,0)node[left,below,font=
\tiny
]
{$
x
$}
;
\draw
[->]
(0,-1.2)--(0,1.2)node[right,font=
\tiny
]
{$
y
$}
;
\draw
[->
, line width=1pt
]
(-1.2,0)--(1.2,0)node[left,below,font=
\tiny
]
{$
x
$}
;
\draw
[->
, line width=1pt
]
(0,-1.2)--(0,1.2)node[right,font=
\tiny
]
{$
y
$}
;
\draw
[dashed]
(-1.2,1)--(1.2,1);
\foreach
\x
in
{
-1,-0.5,0,0.5,1
}{
\draw
(
\x
,0)--(
\x
,0.05)node[below,outer sep=2pt,font=
\tiny
]at(
\x
,0)
{
\pgfmathparse
{
(
\x
)*5
}
\pgfmathresult
}
;
}
\foreach
\y
in
{
0.5,1.0
}{
\draw
(0,
\y
)--(0.05,
\y
)node[left,outer sep=2pt,font=
\tiny
]at(0,
\y
)
{
\y
}
;
}
\draw
[color=red,domain=-1.2:1.2]
plot(
\x
,
{
1/(1+(exp(-5*
\x
)))
}
);
\draw
[color=red,domain=-1.2:1.2
, line width=1pt
]
plot(
\x
,
{
1/(1+(exp(-5*
\x
)))
}
);
\node
[black,anchor=south]
at (0,1.2)
{
\small
$
y
=
\frac
{
1
}{
1
+
e
^{
-
x
}}$}
;
\end{tikzpicture}
%%%------------------------------------------------------------------------------------------------------------
...
...
Book/Chapter5/Figures/fig-softplus.tex
查看文件 @
4638e81f
%%%------------------------------------------------------------------------------------------------------------
\begin{tikzpicture}
\draw
[->]
(-1.2,0)--(1.2,0)node[left,below,font=
\tiny
]
{$
x
$}
;
\draw
[->]
(0,-1.2)--(0,1.2)node[right,font=
\tiny
]
{$
y
$}
;
\draw
[->
, line width=1pt
]
(-1.2,0)--(1.2,0)node[left,below,font=
\tiny
]
{$
x
$}
;
\draw
[->
, line width=1pt
]
(0,-1.2)--(0,1.2)node[right,font=
\tiny
]
{$
y
$}
;
\foreach
\x
in
{
-1.0,-0.5,0.0,0.5,1.0
}{
\draw
(
\x
,0)--(
\x
,0.05)node[below,outer sep=2pt,font=
\tiny
]at(
\x
,0)
{
\x
}
;
}
\foreach
\y
in
{
1.0,0.5
}{
\draw
(0,
\y
)--(0.05,
\y
)node[left,outer sep=2pt,font=
\tiny
]at(0,
\y
)
{
\y
}
;
}
\draw
[color=red ,domain=-1.2:1]
plot(
\x
,
{
ln(1+(exp(
\x
))
}
);
\draw
[color=red ,domain=-1.2:1
, line width=1pt
]
plot(
\x
,
{
ln(1+(exp(
\x
))
}
);
\node
[black,anchor=south]
at (0,1.2)
{
\small
$
y
=
ln
(
1
+
e
^
x
)
$}
;
\end{tikzpicture}
%%%------------------------------------------------------------------------------------------------------------
...
...
Book/Chapter5/Figures/fig-tanh.tex
查看文件 @
4638e81f
%%%------------------------------------------------------------------------------------------------------------
\begin{tikzpicture}
\draw
[->]
(-1.2,0)--(1.2,0)node[left,below,font=
\tiny
]
{$
x
$}
;
\draw
[->]
(0,-1.2)--(0,1.2)node[right,font=
\tiny
]
{$
y
$}
;
\draw
[->
, line width=1pt
]
(-1.2,0)--(1.2,0)node[left,below,font=
\tiny
]
{$
x
$}
;
\draw
[->
, line width=1pt
]
(0,-1.2)--(0,1.2)node[right,font=
\tiny
]
{$
y
$}
;
\draw
[dashed]
(-1.2,1)--(1.2,1);
\draw
[dashed]
(-1.2,-1)--(1.2,-1);
\foreach
\x
in
{
-1.0,-0.5,0.0,0.5,1.0
}{
\draw
(
\x
,0)--(
\x
,0.05)node[below,outer sep=2pt,font=
\tiny
]at(
\x
,0)
{
\x
}
;
}
\foreach
\y
in
{
0.5,1.0
}{
\draw
(0,
\y
)--(0.05,
\y
)node[left,outer sep=2pt,font=
\tiny
]at(0,
\y
)
{
\y
}
;
}
\draw
[color=red ,domain=-1.2:1.2]
plot(
\x
,
{
tanh(
\x
)
}
);
\draw
[color=red ,domain=-1.2:1.2
, line width=1pt
]
plot(
\x
,
{
tanh(
\x
)
}
);
\node
[black,anchor=south]
at (0,1.2)
{
\small
$
y
=
\frac
{
e
^{
x
}
-
e
^{
-
x
}}{
e
^{
x
}
+
e
^{
-
x
}}$}
;
\end{tikzpicture}
%%%------------------------------------------------------------------------------------------------------------
...
...
Book/Chapter5/Figures/fig-two-layer-neural-network.tex
查看文件 @
4638e81f
...
...
@@ -34,12 +34,12 @@
\draw
[->,thick] ([yshift=0.1em]n20.north) -- (y.south);
%% weight and bias
{
\node
[anchor=center,rotate=90,fill=white,inner sep=1pt] (b0) at ([yshift=2em,xshift=-0.5em]b.north)
{
\
tiny
{$
b
_
1
$}}
;
}
{
\node
[anchor=center,rotate=-59,fill=white,inner sep=1pt] (w2) at ([yshift=1em,xshift=-1.0em]x1.north)
{
\
tiny
{$
w
_
1
$}}
;
}
{
\node
[anchor=center,rotate=62,fill=white,inner sep=1pt] (w21) at ([yshift=1.2em,xshift=0em]n10.north)
{
\
tiny
{$
w'
_
1
$}}
;
}
{
\node
[anchor=center,rotate=-62,fill=white,inner sep=1pt] (w22) at ([yshift=1.2em,xshift=-0em]n11.north)
{
\
tiny
{$
w'
_
2
$}}
;
}
{
\node
[anchor=center,rotate=59,fill=white,inner sep=1pt] (b1) at ([yshift=3.4em,xshift=1.5em]b.north)
{
\
tiny
{$
b
_
2
$}}
;
}
{
\node
[anchor=center,rotate=90,fill=white,inner sep=1pt] (w1) at ([yshift=2em,xshift=0.5em]x1.north)
{
\
tiny
{$
w
_
2
$}}
;
}
{
\node
[anchor=center,rotate=90,fill=white,inner sep=1pt] (b0) at ([yshift=2em,xshift=-0.5em]b.north)
{
\
scriptsize
{$
b
_
1
$}}
;
}
{
\node
[anchor=center,rotate=-59,fill=white,inner sep=1pt] (w2) at ([yshift=1em,xshift=-1.0em]x1.north)
{
\
scriptsize
{$
w
_
1
$}}
;
}
{
\node
[anchor=center,rotate=62,fill=white,inner sep=1pt] (w21) at ([yshift=1.2em,xshift=0em]n10.north)
{
\
scriptsize
{$
w'
_
1
$}}
;
}
{
\node
[anchor=center,rotate=-62,fill=white,inner sep=1pt] (w22) at ([yshift=1.2em,xshift=-0em]n11.north)
{
\
scriptsize
{$
w'
_
2
$}}
;
}
{
\node
[anchor=center,rotate=59,fill=white,inner sep=1pt] (b1) at ([yshift=3.4em,xshift=1.5em]b.north)
{
\
scriptsize
{$
b
_
2
$}}
;
}
{
\node
[anchor=center,rotate=90,fill=white,inner sep=1pt] (w1) at ([yshift=2em,xshift=0.5em]x1.north)
{
\
scriptsize
{$
w
_
2
$}}
;
}
%% sigmoid box
\begin{scope}
...
...
Book/Chapter5/chapter5.tex
查看文件 @
4638e81f
...
...
@@ -677,20 +677,20 @@ x_0\cdot w_0+x_1\cdot w_1+x_2\cdot w_2 & = & 0\cdot 1+0\cdot 1+1\cdot 1 \nonumbe
\subfigure
[Sigmoid]
{
\centering
\begin{minipage}
{
.23
\textwidth
}
\input
{
./Chapter5/Figures/fig-
S
igmoid
}
\input
{
./Chapter5/Figures/fig-
s
igmoid
}
\end{minipage}
%
}
\qquad
\subfigure
[Tanh]
{
\centering
\begin{minipage}
{
.23
\textwidth
}
\input
{
./Chapter5/Figures/fig-
T
anh
}
\input
{
./Chapter5/Figures/fig-
t
anh
}
\end{minipage}
}
\\
\vspace
{
-0.5em
}
\subfigure
[ReLU]
{
\centering
\begin{minipage}
{
.23
\textwidth
}
\input
{
./Chapter5/Figures/fig-
R
elu
}
\input
{
./Chapter5/Figures/fig-
r
elu
}
\end{minipage}
%
}
\qquad
...
...
@@ -2164,7 +2164,7 @@ w_{t+1}&=&w_t-\frac{\eta}{\sqrt{z_t+\epsilon}} v_t
\end{figure}
%-------------------------------------------
\parinterval
语言模型的词嵌入是通过词嵌入矩阵进行存储的,矩阵中的每一行对应了一个词的分布式表示结果。图
\ref
{
fig:embedding
}
展示了一个词嵌入矩阵的实例。
\parinterval
语言模型的词嵌入是通过词嵌入矩阵进行存储的,矩阵中的每一行对应了一个词的分布式表示结果。图
\ref
{
fig:embedding
-matrix
}
展示了一个词嵌入矩阵的实例。
%----------------------------------------------
% 图
\begin{figure}
[htp]
...
...
Book/mt-book-xelatex.tex
查看文件 @
4638e81f
...
...
@@ -125,7 +125,7 @@
%\include{Chapter2/chapter2}
%\include{Chapter3/chapter3}
%\include{Chapter4/chapter4}
%
\include{Chapter5/chapter5}
\include
{
Chapter5/chapter5
}
%\include{Chapter6/chapter6}
%\include{Chapter7/chapter7}
%\include{ChapterAppend/chapterappend}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论