Commit 303ff0d2 by 曹润柘

合并分支 'master' 到 'caorunzhe'

Master

查看合并请求 !869
parents 5093aeeb c1472b91
...@@ -4,15 +4,15 @@ ...@@ -4,15 +4,15 @@
\begin{tikzpicture} \begin{tikzpicture}
\begin{scope} \begin{scope}
\tikzstyle{datanode} = [minimum width=5em,minimum height=1.7em,fill=red!20,rounded corners=0.3em]; \tikzstyle{datanode} = [minimum width=5em,minimum height=1.7em,draw,thick,fill=red!20,rounded corners=0.3em];
\tikzstyle{modelnode} = [minimum width=5em,minimum height=1.7em,fill=blue!20,rounded corners=0.3em]; \tikzstyle{modelnode} = [minimum width=5em,minimum height=1.7em,draw,thick,fill=blue!20,rounded corners=0.3em];
\tikzstyle{decodingnode} = [minimum width=5em,minimum height=1.7em,fill=green!20,rounded corners=0.3em]; \tikzstyle{decodingnode} = [minimum width=5em,minimum height=1.7em,draw,thick,fill=green!20,rounded corners=0.3em];
\node [datanode,anchor=north west] (s1) at (0,0) {{ \small{语言1}}}; \node [datanode,anchor=north west] (s1) at (0,0) {{ \small{语言1}}};
\node [datanode,anchor=north] (s2) at ([yshift=-4.5em]s1.south) {{ \small{语言3}}}; \node [datanode,anchor=north] (s2) at ([yshift=-4.5em]s1.south) {{ \small{语言3}}};
\node [datanode,anchor=west] (s3) at ([xshift=4.5em]s1.east) {{ \small{语言2}}}; \node [datanode,anchor=west] (s3) at ([xshift=4.5em]s1.east) {{ \small{语言2}}};
\node [datanode,anchor=north] (s4) at ([yshift=-4.5em]s3.south) {{ \small{语言4}}}; \node [datanode,anchor=north] (s4) at ([yshift=-4.5em]s3.south) {{ \small{语言4}}};
\node [circle,anchor=north west,inner sep=2pt,fill=blue!20] (m1) at ([xshift=0.8em,yshift=-0.5em]s1.south east) {{ \small{中间语言}}}; \node [circle,draw,thick,anchor=north west,inner sep=2pt,fill=blue!30] (m1) at ([xshift=0.8em,yshift=-0.5em]s1.south east) {{ \small{中间语言}}};
\draw [<->,very thick] (s1.south) -- (m1.170); \draw [<->,very thick] (s1.south) -- (m1.170);
\draw [<->,very thick] (s2.north) -- (m1.190); \draw [<->,very thick] (s2.north) -- (m1.190);
...@@ -24,11 +24,11 @@ ...@@ -24,11 +24,11 @@
\end{scope} \end{scope}
\begin{scope}[xshift=16em] \begin{scope}[xshift=21em]
\tikzstyle{datanode} = [minimum width=5em,minimum height=1.7em,fill=red!20,rounded corners=0.3em]; \tikzstyle{datanode} = [minimum width=5em,minimum height=1.7em,draw,thick,fill=red!20,rounded corners=0.3em];
\tikzstyle{modelnode} = [minimum width=5em,minimum height=1.7em,fill=blue!20,rounded corners=0.3em]; \tikzstyle{modelnode} = [minimum width=5em,minimum height=1.7em,draw,thick,fill=blue!20,rounded corners=0.3em];
\tikzstyle{decodingnode} = [minimum width=5em,minimum height=1.7em,fill=green!20,rounded corners=0.3em]; \tikzstyle{decodingnode} = [minimum width=5em,minimum height=1.7em,draw,thick,fill=green!20,rounded corners=0.3em];
\node [datanode,anchor=north west] (s1) at (0,0) {{ \small{语言1}}}; \node [datanode,anchor=north west] (s1) at (0,0) {{ \small{语言1}}};
\node [datanode,anchor=north] (s2) at ([yshift=-4.5em]s1.south) {{ \small{语言3}}}; \node [datanode,anchor=north] (s2) at ([yshift=-4.5em]s1.south) {{ \small{语言3}}};
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
\end{scope} \end{scope}
\begin{scope}[xshift=16.8em,yshift=6em] \begin{scope}[xshift=18.8em,yshift=6em]
{ {
\tikzstyle{numbernode} = [fill=blue!30,minimum height=0.8em,minimum width=0.8em,circle,draw,inner sep=1pt] \tikzstyle{numbernode} = [fill=blue!30,minimum height=0.8em,minimum width=0.8em,circle,draw,inner sep=1pt]
...@@ -94,14 +94,14 @@ ...@@ -94,14 +94,14 @@
\begin{pgfonlayer}{background} \begin{pgfonlayer}{background}
{ {
\node[draw,thin,minimum width=11em,align=left,rounded corners=1pt,fill=red!5,drop shadow] [fit = (outputnode) (word01) (word02) ] (netbox) {}; \node[draw,minimum width=11em,align=left,rounded corners=1pt,fill=red!5,drop shadow] [fit = (outputnode) (word01) (word02) ] (netbox) {};
\node[rectangle,draw,thin,inner sep=3pt,rounded corners=1pt] [fit = (neuron01) (neuron02) (neuron03) (neuron04)] (layer1) {}; \node[rectangle,draw,thin,inner sep=3pt,rounded corners=1pt] [fit = (neuron01) (neuron02) (neuron03) (neuron04)] (layer1) {};
\node[rectangle,draw,thin,inner sep=3pt,rounded corners=1pt] [fit = (neuron11) (neuron12) (neuron13) (neuron14)] (layer2) {}; \node[rectangle,draw,thin,inner sep=3pt,rounded corners=1pt] [fit = (neuron11) (neuron12) (neuron13) (neuron14)] (layer2) {};
\node[rectangle,draw,thin,inner sep=3pt,rounded corners=1pt] [fit = (neuron21) (neuron22) (neuron23) (neuron24) (neuron25)] (layer3) {}; \node[rectangle,draw,thin,inner sep=3pt,rounded corners=1pt] [fit = (neuron21) (neuron22) (neuron23) (neuron24) (neuron25)] (layer3) {};
} }
\end{pgfonlayer} \end{pgfonlayer}
\draw [->,very thick,dotted] (enclabel.east) ..controls + (east:2em) and +(west:2em).. ([yshift=-1em]netbox.west); \draw [->,very thick,dotted] (enclabel.east) ..controls + (east:4em) and +(west:4em).. ([yshift=1em]netbox.west);
\node [anchor=north] (netlabel) at (netbox.south) {\footnotesize{编码器网络示例}}; \node [anchor=north] (netlabel) at (netbox.south) {\footnotesize{编码器网络示例}};
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
%%% 句法树(层次短语) %%% 句法树(层次短语)
\begin{tikzpicture} \begin{tikzpicture}
{\small {\small
\begin{scope}[sibling distance=25pt, level distance = 20pt] \begin{scope}[sibling distance=25pt, level distance = 25pt]
{\scriptsize {\scriptsize
\Tree[.\node(r){IP}; \Tree[.\node(r){IP};
[.\node(n11){NP}; [.\node(n21){PN}; [.\node(l1){};]]] [.\node(n11){NP}; [.\node(n21){PN}; [.\node(l1){};]]]
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
\begin{pgfonlayer}{background} \begin{pgfonlayer}{background}
{ {
\node[rectangle,draw=ublue, inner sep=0mm] [fit = (rule1) (rule2) (rule3) (rule3part2) (rule4) (rule4part2) (rule5) (rule5part2) (rule6) (rule6part2) (rulebaselabel)] {}; \node[rectangle,draw=ublue, thick,inner sep=0mm] [fit = (rule1) (rule2) (rule3) (rule3part2) (rule4) (rule4part2) (rule5) (rule5part2) (rule6) (rule6part2) (rulebaselabel)] {};
} }
\end{pgfonlayer} \end{pgfonlayer}
} }
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
\begin{pgfonlayer}{background} \begin{pgfonlayer}{background}
{ {
\node[rectangle,draw=ublue, inner sep=0mm] [fit = (example1) (example1part2) (example2) (example2part2) (example3) (example3part2) (example4) (bidatalabel)(example6)] (bidata) {}; \node[rectangle,draw=ublue, thick, inner sep=0mm] [fit = (example1) (example1part2) (example2) (example2part2) (example3) (example3part2) (example4) (bidatalabel)(example6)] (bidata) {};
} }
\end{pgfonlayer} \end{pgfonlayer}
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
\begin{pgfonlayer}{background} \begin{pgfonlayer}{background}
{ {
\node[rectangle,draw=ublue, inner sep=0mm] [fit = (entry1) (entry2) (entry3) (entry4) (entry5)(entry6)(monodatalabel)] (monodata) {}; \node[rectangle,draw=ublue, thick, inner sep=0mm] [fit = (entry1) (entry2) (entry3) (entry4) (entry5)(entry6)(monodatalabel)] (monodata) {};
} }
\end{pgfonlayer} \end{pgfonlayer}
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
\begin{pgfonlayer}{background} \begin{pgfonlayer}{background}
{ {
\node[rectangle,draw=ublue, inner sep=0mm] [fit = (phrase1) (phrase2) (phrase3) (phrase4) (phrase4part2) (phrase5) (phrase5part2) (phrase6)(phrase7) (phrasetablelabel)] (phrasetable) {}; \node[rectangle,draw=ublue, thick, inner sep=0mm] [fit = (phrase1) (phrase2) (phrase3) (phrase4) (phrase4part2) (phrase5) (phrase5part2) (phrase6)(phrase7) (phrasetablelabel)] (phrasetable) {};
} }
\end{pgfonlayer} \end{pgfonlayer}
...@@ -88,7 +88,7 @@ ...@@ -88,7 +88,7 @@
\begin{pgfonlayer}{background} \begin{pgfonlayer}{background}
{ {
\node[rectangle,draw=ublue, inner sep=0mm] [fit = (ngram1) (ngram2) (ngram3) (ngram4) (lmlabel) (ngrame)] (langaugemodel) {}; \node[rectangle,draw=ublue, thick, inner sep=0mm] [fit = (ngram1) (ngram2) (ngram3) (ngram4) (lmlabel) (ngrame)] (langaugemodel) {};
} }
\end{pgfonlayer} \end{pgfonlayer}
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
\begin{tikzpicture} \begin{tikzpicture}
\begin{scope} \begin{scope}
\tikzstyle{node1} = [minimum width=7em,minimum height=1.7em,fill=red!20,rounded corners=0.3em]; \tikzstyle{node1} = [minimum width=7em,minimum height=1.7em,draw,thick,fill=red!20,rounded corners=0.3em];
\tikzstyle{node2} = [minimum width=7em,minimum height=2.5em,fill=blue!20,rounded corners=0.3em]; \tikzstyle{node2} = [minimum width=7em,minimum height=2.5em,draw,thick,fill=blue!20,rounded corners=0.3em];
\tikzstyle{node3} = [minimum width=7em,minimum height=2.5em,fill=green!20,rounded corners=0.3em]; \tikzstyle{node3} = [minimum width=7em,minimum height=2.5em,draw,thick,fill=green!20,rounded corners=0.3em];
\tikzstyle{node4} = [minimum width=7em,minimum height=1.7em,fill=orange!20,rounded corners=0.3em]; \tikzstyle{node4} = [minimum width=7em,minimum height=1.7em,draw,thick,fill=orange!20,rounded corners=0.3em];
\tikzstyle{node5} = [minimum width=4.5em,minimum height=1.7em,dashed]; \tikzstyle{node5} = [minimum width=4.5em,minimum height=1.7em,thick,dashed];
\node [node1,anchor=south west] (s1) at (0,0) {{ \small{源语言词串}}}; \node [node1,anchor=south west] (s1) at (0,0) {{ \small{源语言词串}}};
\node [node2,anchor=south] (s2) at ([xshift=2.5em,yshift=2em]s1.north) {}; \node [node2,anchor=south] (s2) at ([xshift=2.5em,yshift=2em]s1.north) {};
......
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
\begin{tikzpicture} \begin{tikzpicture}
\begin{scope} \begin{scope}
\tikzstyle{datanode} = [minimum width=7em,minimum height=1.7em,fill=red!20,rounded corners=0.3em]; \tikzstyle{datanode} = [minimum width=7em,minimum height=1.7em,thick,draw,fill=red!20,rounded corners=0.3em];
\tikzstyle{modelnode} = [minimum width=7em,minimum height=1.7em,fill=blue!20,rounded corners=0.3em]; \tikzstyle{modelnode} = [minimum width=7em,minimum height=1.7em,thick,draw,fill=blue!20,rounded corners=0.3em];
\tikzstyle{decodingnode} = [minimum width=7em,minimum height=1.7em,fill=green!20,rounded corners=0.3em]; \tikzstyle{decodingnode} = [minimum width=7em,minimum height=1.7em,thick,draw,fill=green!20,rounded corners=0.3em];
\node [datanode,anchor=north west,minimum height=1.7em,minimum width=8em] (s1) at (0,0) {{ \small{源文句子}}}; \node [datanode,anchor=north west,minimum height=1.7em,minimum width=8em] (s1) at (0,0) {{ \small{源文句子}}};
\node [modelnode,anchor=north,minimum height=1.7em,minimum width=8em] (s2) at ([yshift=-1.5em]s1.south) {{ \small{源语词法分析}}}; \node [modelnode,anchor=north,minimum height=1.7em,minimum width=8em] (s2) at ([yshift=-1.5em]s1.south) {{ \small{源语词法分析}}};
...@@ -14,14 +14,14 @@ ...@@ -14,14 +14,14 @@
\node [modelnode,anchor=north,minimum height=1.7em,minimum width=8em] (s4) at ([yshift=-1.5em]s3.south) {{ \small{源语句法分析}}}; \node [modelnode,anchor=north,minimum height=1.7em,minimum width=8em] (s4) at ([yshift=-1.5em]s3.south) {{ \small{源语句法分析}}};
\node [datanode,anchor=north,minimum height=1.7em,minimum width=8em] (s5) at ([yshift=-1.5em]s4.south) {{ \small{源文结构}}}; \node [datanode,anchor=north,minimum height=1.7em,minimum width=8em] (s5) at ([yshift=-1.5em]s4.south) {{ \small{源文结构}}};
\node [datanode,anchor=west,minimum height=1.7em,minimum width=8em] (t1) at ([xshift=14em]s1.east) {{ \small{译文句子}}}; \node [datanode,anchor=west,minimum height=1.7em,minimum width=8em] (t1) at ([xshift=20em]s1.east) {{ \small{译文句子}}};
\node [modelnode,anchor=north,minimum height=1.7em,minimum width=8em] (t2) at ([yshift=-1.5em]t1.south) {{ \small{目标语词法生成}}}; \node [modelnode,anchor=north,minimum height=1.7em,minimum width=8em] (t2) at ([yshift=-1.5em]t1.south) {{ \small{目标语词法生成}}};
\node [datanode,anchor=north,minimum height=1.7em,minimum width=8em] (t3) at ([yshift=-1.5em]t2.south) {{ \small{译文词串}}}; \node [datanode,anchor=north,minimum height=1.7em,minimum width=8em] (t3) at ([yshift=-1.5em]t2.south) {{ \small{译文词串}}};
\node [modelnode,anchor=north,minimum height=1.7em,minimum width=8em] (t4) at ([yshift=-1.5em]t3.south) {{ \small{目标语句法生成}}}; \node [modelnode,anchor=north,minimum height=1.7em,minimum width=8em] (t4) at ([yshift=-1.5em]t3.south) {{ \small{目标语句法生成}}};
\node [datanode,anchor=north,minimum height=1.7em,minimum width=8em] (t5) at ([yshift=-1.5em]t4.south) {{ \small{译文结构}}}; \node [datanode,anchor=north,minimum height=1.7em,minimum width=8em] (t5) at ([yshift=-1.5em]t4.south) {{ \small{译文结构}}};
\node [decodingnode,anchor=west,minimum height=1.7em,minimum width=8em] (st1) at ([xshift=2.5em,yshift=0.85em]s5.east) {{ \small{源语-目标语词汇转换}}}; \node [decodingnode,anchor=west,minimum height=1.7em,minimum width=13em,inner sep=3pt] (st1) at ([xshift=3.5em,yshift=0.85em]s5.east) {{ \small{源语-目标语词汇转换}}};
\node [decodingnode,anchor=north,minimum height=1.7em,minimum width=8em] (st2) at ([yshift=0.05em]st1.south) {{ \small{源语-目标语结构转换}}}; \node [decodingnode,anchor=north,minimum height=1.7em,minimum width=13em,inner sep=3pt] (st2) at ([yshift=0.05em]st1.south) {{ \small{源语-目标语结构转换}}};
\draw [->,very thick] (s1.south) -- (s2.north); \draw [->,very thick] (s1.south) -- (s2.north);
\draw [->,very thick] (s2.south) -- (s3.north); \draw [->,very thick] (s2.south) -- (s3.north);
......
...@@ -8,22 +8,22 @@ ...@@ -8,22 +8,22 @@
{ {
\begin{tikzpicture} \begin{tikzpicture}
\node [anchor=south west, fill=blue!50, minimum width=1.1cm, minimum height=2.3cm] (mt) at (1,0) {{\color{white} {\small\sffamily\bfseries{机器}}}}; \node [anchor=south west, fill=blue!70, minimum width=1.1cm, minimum height=2.3cm] (mt) at (1,0) {{\color{white} {\small\sffamily\bfseries{机器}}}};
\node [anchor=south west, fill=red!50, minimum width=1.1cm, minimum height=2.7cm] (human) at ([xshift=0.5cm]mt.south east) {{\color{white} {\small\sffamily\bfseries{}}}}; \node [anchor=south west, fill=red!70, minimum width=1.1cm, minimum height=2.7cm] (human) at ([xshift=0.5cm]mt.south east) {{\color{white} {\small\sffamily\bfseries{}}}};
\node [anchor=south] (mtscore) at (mt.north) {3.9}; \node [anchor=south] (mtscore) at (mt.north) {3.9};
\node [anchor=south] (humanscore) at (human.north) {4.7}; \node [anchor=south] (humanscore) at (human.north) {4.7};
\draw [->,thick] ([xshift=-0.5cm]mt.south west) -- ([xshift=0.5cm]human.south east); \draw [->,very thick] ([xshift=-0.5cm]mt.south west) -- ([xshift=0.5cm]human.south east);
\draw [->,thick] ([xshift=-0.5cm]mt.south west) -- ([xshift=-0.5cm,yshift=3.2cm]mt.south west); \draw [->,very thick] ([xshift=-0.5cm]mt.south west) -- ([xshift=-0.5cm,yshift=3.2cm]mt.south west);
\node [anchor=north west] (x1) at ([xshift=0.0cm]human.south east) {\footnotesize{评价对象}}; \node [anchor=north west] (x1) at ([xshift=0.0cm]human.south east) {\footnotesize{评价对象}};
\node [anchor=north east] (y1) at ([xshift=-0.5cm,yshift=3.2cm]mt.south west) {\footnotesize{打分}}; \node [anchor=north east] (y1) at ([xshift=-0.5cm,yshift=3.2cm]mt.south west) {\footnotesize{打分}};
\node [anchor=north] (y2) at ([yshift=-0cm]y1.south) {\footnotesize{(分)}}; \node [anchor=north] (y2) at ([yshift=-0cm]y1.south) {\footnotesize{(分)}};
\node [anchor=south west, fill=blue!50, minimum width=1.1cm, minimum height=1.5cm] (mt1) at ([xshift=13.0em,yshift=-3.0em]mt.east) {{\color{white} {\small\sffamily\bfseries{机器}}}}; \node [anchor=south west, fill=blue!70, minimum width=1.1cm, minimum height=1.5cm] (mt1) at ([xshift=16.0em,yshift=-3.0em]mt.east) {{\color{white} {\small\sffamily\bfseries{机器}}}};
\node [anchor=south west, fill=red!50, minimum width=1.1cm, minimum height=2.7cm] (human1) at ([xshift=0.5cm]mt1.south east) {{\color{white} {\small\sffamily\bfseries{}}}}; \node [anchor=south west, fill=red!70, minimum width=1.1cm, minimum height=2.7cm] (human1) at ([xshift=0.5cm]mt1.south east) {{\color{white} {\small\sffamily\bfseries{}}}};
\node [anchor=south] (mtscore1) at (mt1.north) {47}; \node [anchor=south] (mtscore1) at (mt1.north) {47};
\node [anchor=south] (humanscore1) at (human1.north) {100}; \node [anchor=south] (humanscore1) at (human1.north) {100};
\draw [->,thick] ([xshift=-0.5cm]mt1.south west) -- ([xshift=0.5cm]human1.south east); \draw [->,very thick] ([xshift=-0.5cm]mt1.south west) -- ([xshift=0.5cm]human1.south east);
\draw [->,thick] ([xshift=-0.5cm]mt1.south west) -- ([xshift=-0.5cm,yshift=3.2cm]mt1.south west); \draw [->,very thick] ([xshift=-0.5cm]mt1.south west) -- ([xshift=-0.5cm,yshift=3.2cm]mt1.south west);
\node [anchor=north west] (x1) at ([xshift=0.0cm]human1.south east) {\footnotesize{评价对象}}; \node [anchor=north west] (x1) at ([xshift=0.0cm]human1.south east) {\footnotesize{评价对象}};
\node [anchor=north east] (y1) at ([xshift=-0.5cm,yshift=3.2cm]mt1.south west) {\footnotesize{打分}}; \node [anchor=north east] (y1) at ([xshift=-0.5cm,yshift=3.2cm]mt1.south west) {\footnotesize{打分}};
\node [anchor=north] (y2) at ([yshift=-0cm]y1.south) {\footnotesize{(分)}}; \node [anchor=north] (y2) at ([yshift=-0cm]y1.south) {\footnotesize{(分)}};
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
\begin{pgfonlayer}{background} \begin{pgfonlayer}{background}
{ {
\node[rectangle,draw=ublue, inner sep=0mm] [fit = (example1) (example1part2) (example2) (example2part2) (example3) (examplebaselabel)] {}; \node[rectangle,draw=ublue, thick,inner sep=0mm] [fit = (example1) (example1part2) (example2) (example2part2) (example3) (examplebaselabel)] {};
} }
\end{pgfonlayer} \end{pgfonlayer}
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
\begin{pgfonlayer}{background} \begin{pgfonlayer}{background}
{ {
\node[rectangle,draw=ublue, inner sep=0mm] [fit = (entry1) (entry2) (entry3) (entry4) (dictionarylabel)] {}; \node[rectangle,draw=ublue, thick,inner sep=0mm] [fit = (entry1) (entry2) (entry3) (entry4) (dictionarylabel)] {};
} }
\end{pgfonlayer} \end{pgfonlayer}
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
%---------------------------------------------- %----------------------------------------------
\begin{figure}[htp] \begin{figure}[htp]
\centering \centering
\includegraphics[scale=0.2]{./Chapter1/Figures/figure-zh_en-example.png} \includegraphics[scale=0.25]{./Chapter1/Figures/figure-zh_en-example.png}
\caption{通过计算机将汉语翻译为英语} \caption{通过计算机将汉语翻译为英语}
\label{fig:1-1} \label{fig:1-1}
\end{figure} \end{figure}
......
\begin{tikzpicture} \begin{tikzpicture}
\tikzstyle{node1}=[inner sep=0mm,minimum height=1.5em,minimum width=3em,fill=ugreen!10!blue!10] \tikzstyle{node1}=[inner sep=0mm,minimum height=1.5em,minimum width=3em,fill=blue!10]
\tikzstyle{node2}=[inner sep=0mm,minimum height=1.5em,minimum width=3em,fill=ugreen!20!blue!20] \tikzstyle{node2}=[inner sep=0mm,minimum height=1.5em,minimum width=3em,fill=blue!25]
\tikzstyle{node3}=[inner sep=0mm,minimum height=1.5em,minimum width=3em,fill=ugreen!30!blue!30] \tikzstyle{node3}=[inner sep=0mm,minimum height=1.5em,minimum width=3em,fill=blue!40]
\tikzstyle{node4}=[inner sep=0mm,minimum height=1.5em,minimum width=3em,fill=ugreen!40!blue!40] \tikzstyle{node4}=[inner sep=0mm,minimum height=1.5em,minimum width=3em,fill=blue!55]
\tikzstyle{node5}=[inner sep=0mm,minimum height=1.5em,minimum width=3em,fill=ugreen!50!blue!50] \tikzstyle{node5}=[inner sep=0mm,minimum height=1.5em,minimum width=3em,fill=blue!70]
\begin{scope} \begin{scope}
\foreach \i / \j / \z in \foreach \i / \j / \z in
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
\node[anchor=north west] (y1) at ([xshift=14.5em,yshift=-1.3em]n00.south west) {训练时长}; \node[anchor=north west] (y1) at ([xshift=14.5em,yshift=-1.3em]n00.south west) {训练时长};
\node[anchor=west,font=\small] (t1) at ([xshift=0.5em,yshift=0em]n52.east) {$\cdots$}; \node[anchor=west,font=\small] (t1) at ([xshift=0.5em,yshift=0em]n52.east) {$\cdots$};
\node[anchor=west,node1,minimum width=0.5em] (c1) at ([xshift=3em,yshift=-2.5em]t1.east) {}; \node[anchor=west,node1,minimum width=0.5em] (c1) at ([xshift=5em,yshift=0em]n50.east) {};
\node[anchor=south,node2,minimum width=0.5em] (c2) at ([xshift=0em,yshift=0em]c1.north) {}; \node[anchor=south,node2,minimum width=0.5em] (c2) at ([xshift=0em,yshift=0em]c1.north) {};
\node[anchor=south,node3,minimum width=0.5em] (c3) at ([xshift=0em,yshift=0em]c2.north) {}; \node[anchor=south,node3,minimum width=0.5em] (c3) at ([xshift=0em,yshift=0em]c2.north) {};
\node[anchor=south,node4,minimum width=0.5em] (c4) at ([xshift=0em,yshift=0em]c3.north) {}; \node[anchor=south,node4,minimum width=0.5em] (c4) at ([xshift=0em,yshift=0em]c3.north) {};
......
...@@ -18,10 +18,10 @@ ...@@ -18,10 +18,10 @@
\node [] (standard) at ([xshift=-1em]neuron_z.west) {\scriptsize{$\mathbf{w}_{i}^{l}$}}; \node [] (standard) at ([xshift=-1em]neuron_z.west) {\scriptsize{$\mathbf{w}_{i}^{l}$}};
\node [] (standard) at ([xshift=0.6em,yshift=0.3em]neuron_z.east) {\scriptsize{$f$}}; \node [] (standard) at ([xshift=0.6em,yshift=0.3em]neuron_z.east) {\scriptsize{$f$}};
\draw [->,line width=0.3mm] (neuron_b.east) -- (neuron_z.west); \draw [->,line width=0.3mm] (neuron_b.east) -- (neuron_z.130);
\draw [->,line width=0.3mm] (neuron_y3.east) -- (neuron_z.west); \draw [->,line width=0.3mm] (neuron_y3.east) -- (neuron_z.170);
\draw [->,line width=0.3mm] (neuron_y2.east) -- (neuron_z.west); \draw [->,line width=0.3mm] (neuron_y2.east) -- (neuron_z.190);
\draw [->,line width=0.3mm] (neuron_y1.east) -- (neuron_z.west); \draw [->,line width=0.3mm] (neuron_y1.east) -- (neuron_z.230);
\draw [->,line width=0.3mm] (neuron_z.east) -- (neuron_y'.west); \draw [->,line width=0.3mm] (neuron_z.east) -- (neuron_y'.west);
%dropout %dropout
...@@ -44,10 +44,10 @@ ...@@ -44,10 +44,10 @@
\node [] (standard) at ([xshift=-1em]drop_neuron_z.west) {\scriptsize{$\mathbf{w}_{i}^{l}$}}; \node [] (standard) at ([xshift=-1em]drop_neuron_z.west) {\scriptsize{$\mathbf{w}_{i}^{l}$}};
\node [] (standard) at ([xshift=0.6em,yshift=0.3em]drop_neuron_z.east) {\scriptsize{$f$}}; \node [] (standard) at ([xshift=0.6em,yshift=0.3em]drop_neuron_z.east) {\scriptsize{$f$}};
%structure %structure
\draw [->,line width=0.3mm] (drop_neuron_b.east) -- (drop_neuron_z.west); \draw [->,line width=0.3mm] (drop_neuron_b.east) -- (drop_neuron_z.130);
\draw [->,line width=0.3mm] (drop_neuron_y3'.east) -- (drop_neuron_z.west); \draw [->,line width=0.3mm] (drop_neuron_y3'.east) -- (drop_neuron_z.170);
\draw [->,line width=0.3mm] (drop_neuron_y2'.east) -- (drop_neuron_z.west); \draw [->,line width=0.3mm] (drop_neuron_y2'.east) -- (drop_neuron_z.190);
\draw [->,line width=0.3mm] (drop_neuron_y1'.east) -- (drop_neuron_z.west); \draw [->,line width=0.3mm] (drop_neuron_y1'.east) -- (drop_neuron_z.230);
\draw [->,line width=0.3mm] (drop_neuron_z.east) -- (drop_neuron_y'.west); \draw [->,line width=0.3mm] (drop_neuron_z.east) -- (drop_neuron_y'.west);
%r %r
\draw [->,line width=0.3mm] (drop_neuron_y3.east) -- (drop_neuron_y3'.west); \draw [->,line width=0.3mm] (drop_neuron_y3.east) -- (drop_neuron_y3'.west);
......
\begin{tikzpicture} \begin{tikzpicture}
\tikzstyle{node}=[inner sep=0mm,minimum height=3em,minimum width=6em,rounded corners=5pt] \tikzstyle{node}=[inner sep=0mm, draw,thick,minimum height=3em,minimum width=6em,rounded corners=5pt]
\node[anchor=west,node,fill=ugreen!15] (n1) at (0,0) {训练集}; \node[anchor=west,node,fill=ugreen!15] (n1) at (0,0) {训练集};
......
...@@ -6,30 +6,30 @@ ...@@ -6,30 +6,30 @@
\setlength{\YShift}{0.8\base} \setlength{\YShift}{0.8\base}
\setlength{\XShift}{0.8\base} \setlength{\XShift}{0.8\base}
\tikzstyle{modelnode} = [rectangle,draw,rounded corners=2pt,inner sep=0pt,minimum height=4.5em,minimum width=2em,font=\small,anchor=north] \tikzstyle{modelnode} = [rectangle,draw,thick,rounded corners=2pt,inner sep=2pt,minimum height=4.5em,minimum width=2em,font=\small,anchor=north]
\coordinate (stu01) at (0,0); \coordinate (stu01) at (0,0);
\coordinate (stu02) at ([xshift=3em]stu01); \coordinate (stu02) at ([xshift=4em]stu01);
\coordinate (stu03) at ([xshift=3em]stu02); \coordinate (stu03) at ([xshift=4em]stu02);
\coordinate (stu04) at ([xshift=3em]stu03); \coordinate (stu04) at ([xshift=4em]stu03);
\coordinate (stu05) at ([xshift=3em]stu04); \coordinate (stu05) at ([xshift=4em]stu04);
\coordinate (tea01) at ([xshift=8em]stu05); \coordinate (tea01) at ([xshift=10em]stu05);
\coordinate (tea02) at ([xshift=3em]tea01); \coordinate (tea02) at ([xshift=4em]tea01);
% iterations % iterations
\foreach \curr / \prev in {1/0,2/1,3/2} \foreach \curr / \prev in {1/0,2/1,3/2}
{ {
% models % models
\node[modelnode,fill=yellow!20] (stu\curr1) at ([yshift=-2em]stu\prev1.south) {\rotatebox{90}{学生模型 $1$}}; \node[modelnode,fill=yellow!20] (stu\curr1) at ([yshift=-3em]stu\prev1.south) {\rotatebox{90}{学生模型 $1$}};
\node[modelnode,fill=yellow!20] (stu\curr2) at ([yshift=-2em]stu\prev2.south) {\rotatebox{90}{学生模型 $2$}}; \node[modelnode,fill=yellow!20] (stu\curr2) at ([yshift=-3em]stu\prev2.south) {\rotatebox{90}{学生模型 $2$}};
\node[modelnode,fill=yellow!20] (stu\curr3) at ([yshift=-2em]stu\prev3.south) {\rotatebox{90}{学生模型 $3$}}; \node[modelnode,fill=yellow!20] (stu\curr3) at ([yshift=-3em]stu\prev3.south) {\rotatebox{90}{学生模型 $3$}};
\node[modelnode,fill=yellow!20] (stu\curr4) at ([yshift=-2em]stu\prev4.south) {\rotatebox{90}{学生模型 $4$}}; \node[modelnode,fill=yellow!20] (stu\curr4) at ([yshift=-3em]stu\prev4.south) {\rotatebox{90}{学生模型 $4$}};
\node[modelnode,fill=yellow!20] (stu\curr5) at ([yshift=-2em]stu\prev5.south) {\rotatebox{90}{学生模型 $5$}}; \node[modelnode,fill=yellow!20] (stu\curr5) at ([yshift=-3em]stu\prev5.south) {\rotatebox{90}{学生模型 $5$}};
\node[modelnode] (tea\curr1) at ([yshift=-2em]tea\prev1.south) {\rotatebox{90}{\color{red!60} 教师模型 $1$}}; \node[modelnode] (tea\curr1) at ([yshift=-3em]tea\prev1.south) {\rotatebox{90}{\color{red!60} 教师模型 $1$}};
\node[modelnode] (tea\curr2) at ([yshift=-2em]tea\prev2.south) {\rotatebox{90}{\color{blue!60} 教师模型 $2$}}; \node[modelnode] (tea\curr2) at ([yshift=-3em]tea\prev2.south) {\rotatebox{90}{\color{blue!60} 教师模型 $2$}};
% 集成 labels % 集成 labels
\draw[-latex'] ([xshift=2pt]stu\curr5.east) to node [auto] {\small 集成} ([xshift=-2pt]tea\curr1.west); \draw[->,very thick] ([xshift=2pt]stu\curr5.east) to node [auto] {\small 集成} ([xshift=-2pt]tea\curr1.west);
} }
% iteration labels % iteration labels
...@@ -37,8 +37,8 @@ ...@@ -37,8 +37,8 @@
\node[font=\small,anchor=east,purple!80] (iterate2) at ([xshift=-1em]stu31.west) {\rotatebox{90}{轮数 $2$}}; \node[font=\small,anchor=east,purple!80] (iterate2) at ([xshift=-1em]stu31.west) {\rotatebox{90}{轮数 $2$}};
% distillation labels % distillation labels
\node[font=\small,anchor=south west] (distill1) at ([yshift=0.8em]iterate1.north west) {知识蒸馏}; \node[font=\small,anchor=south west] (distill1) at ([yshift=1.2em]iterate1.north west) {知识蒸馏};
\node[font=\small,anchor=south west] (distill2) at ([yshift=0.8em]iterate2.north west) {知识蒸馏}; \node[font=\small,anchor=south west] (distill2) at ([yshift=1.2em]iterate2.north west) {知识蒸馏};
% 学生模型 groups % 学生模型 groups
\begin{pgfonlayer}{background} \begin{pgfonlayer}{background}
...@@ -50,10 +50,10 @@ ...@@ -50,10 +50,10 @@
\end{pgfonlayer} \end{pgfonlayer}
% distillation % distillation
\draw[-latex',red!60,very thick] (tea11.south) .. controls +(south:1.5em) and +(north:2em) .. (group21.north); \draw[-latex',red!60,very thick] (tea11.south) .. controls +(south:1.5em) and +(north:3em) .. (group21.north);
\draw[-latex',blue!60,very thick] (tea12.south) .. controls +(south:2em) and +(north:1.5em) .. (group22.north); \draw[-latex',blue!60,very thick] (tea12.south) .. controls +(south:2em) and +(north:2em) .. (group22.north);
\draw[-latex',red!60,very thick] (tea21.south) .. controls +(south:2em) and +(north:2.5em) .. (group32.north); \draw[-latex',red!60,very thick] (tea21.south) .. controls +(south:2em) and +(north:2.5em) .. (group32.north);
\draw[-latex',blue!60,very thick] (tea22.south) .. controls +(south:2em) and +(north:1.5em) .. (group31.north); \draw[-latex',blue!60,very thick] (tea22.south) .. controls +(south:2em) and +(north:3em) .. (group31.north);
\end{tikzpicture} \end{tikzpicture}
\ No newline at end of file
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
\begin{scope}[] \begin{scope}[]
\tikzstyle{rnnnode} = [draw,inner sep=2pt,minimum width=3em,minimum height=1.5em,rounded corners=1pt,fill=red!15] \tikzstyle{rnnnode} = [draw,thick,inner sep=2pt,minimum width=3em,minimum height=1.5em,rounded corners=1pt,fill=red!15]
\tikzstyle{snode} = [draw,inner sep=2pt,minimum width=3em,minimum height=1.5em,rounded corners=1pt,fill=blue!15] \tikzstyle{snode} = [draw,thick,inner sep=2pt,minimum width=3em,minimum height=1.5em,rounded corners=1pt,fill=blue!15]
\tikzstyle{ynode} = [inner sep=2pt,minimum width=3em,minimum height=1.5em,rounded corners=1pt] \tikzstyle{ynode} = [inner sep=2pt,minimum width=3em,minimum height=1.5em,rounded corners=1pt]
...@@ -122,8 +122,8 @@ ...@@ -122,8 +122,8 @@
\begin{scope}[yshift=-2in] \begin{scope}[yshift=-2in]
\tikzstyle{rnnnode} = [draw,inner sep=2pt,minimum width=3em,minimum height=1.5em,rounded corners=1pt,fill=red!15] \tikzstyle{rnnnode} = [draw,thick,inner sep=2pt,minimum width=3em,minimum height=1.5em,rounded corners=1pt,fill=red!15]
\tikzstyle{snode} = [draw,inner sep=2pt,minimum width=3em,minimum height=1.5em,rounded corners=1pt,fill=blue!15] \tikzstyle{snode} = [draw,thick,inner sep=2pt,minimum width=3em,minimum height=1.5em,rounded corners=1pt,fill=blue!15]
\tikzstyle{ynode} = [inner sep=2pt,minimum width=3em,minimum height=1.5em,rounded corners=1pt] \tikzstyle{ynode} = [inner sep=2pt,minimum width=3em,minimum height=1.5em,rounded corners=1pt]
...@@ -166,8 +166,8 @@ ...@@ -166,8 +166,8 @@
\draw [->,thick,dotted] ([xshift=-2.5em,yshift=1em]n11.north) .. controls +(south:2em) and +(west:0.1em) .. ([xshift=0.2em,yshift=0em]n11.west); \draw [->,thick,dotted] ([xshift=-2.5em,yshift=1em]n11.north) .. controls +(south:2em) and +(west:0.1em) .. ([xshift=0.2em,yshift=0em]n11.west);
\draw [->,thick,dotted] ([xshift=0em,yshift=0em]n14.east) .. controls +(east:0.3em) and +(north:2em) .. ([xshift=2.5em,yshift=-0.5em]n14.south); \draw [->,thick,dotted] ([xshift=0em,yshift=0em]n14.east) .. controls +(east:0.3em) and +(north:1.5em) .. ([xshift=2.5em,yshift=-0.5em]n14.south);
\draw [->,thick,dotted] ([xshift=0em,yshift=0em]n6.east) .. controls ([xshift=2em,yshift=1em]n6.east) and ([xshift=-2em,yshift=-2em]n4.south west) .. ([xshift=0.2em,yshift=-0em]n12.west); \draw [->,thick,dotted] ([xshift=0em,yshift=0em]n6.east) .. controls +(east:2em) and +(west:2em) .. ([xshift=0.2em,yshift=-0em]n12.west);
\draw [->,thick] ([xshift=-0em,yshift=0em]n11.north)--([xshift=-0em,yshift=0em]n3.south); \draw [->,thick] ([xshift=-0em,yshift=0em]n11.north)--([xshift=-0em,yshift=0em]n3.south);
\draw [->,thick] ([xshift=0em,yshift=0em]n12.north)--([xshift=-0em,yshift=-0em]n4.south); \draw [->,thick] ([xshift=0em,yshift=0em]n12.north)--([xshift=-0em,yshift=-0em]n4.south);
......
...@@ -9,9 +9,9 @@ ...@@ -9,9 +9,9 @@
\node [anchor=west,wode] (n1) at (0,0) {$y$}; \node [anchor=west,wode] (n1) at (0,0) {$y$};
\node [anchor=north west,wode] (n2) at ([xshift=3em,yshift=-2.5em]n1.south east) {$x$}; \node [anchor=north west,wode] (n2) at ([xshift=3em,yshift=-2.5em]n1.south east) {$x$};
\node [anchor=south west,rnnnode] (n3) at ([xshift=8em,yshift=0.5em]n2.north east) {生成模型$G$}; \node [anchor=south west,rnnnode,thick] (n3) at ([xshift=8em,yshift=0.5em]n2.north east) {生成模型$G$};
\node [anchor=south east,wode] (n4) at ([xshift=-2em,yshift=0em]n3.north west) {$\hat{y}$}; \node [anchor=south east,wode] (n4) at ([xshift=-2em,yshift=0em]n3.north west) {$\hat{y}$};
\node [anchor=south,snode] (n5) at ([xshift=0em,yshift=6em]n2.north) {判别网络$D$}; \node [anchor=south,snode,thick] (n5) at ([xshift=0em,yshift=6em]n2.north) {判别网络$D$};
\node [anchor=west,align=left,font=\small] (n6) at ([xshift=15em,yshift=-3em]n5.east) {根据$(\seq{x},\seq{\hat{y}})$\\成奖励信号}; \node [anchor=west,align=left,font=\small] (n6) at ([xshift=15em,yshift=-3em]n5.east) {根据$(\seq{x},\seq{\hat{y}})$\\成奖励信号};
......
...@@ -55,18 +55,18 @@ ...@@ -55,18 +55,18 @@
\node [anchor=south,font=\scriptsize] (w8) at (label7.north) {$0.1$}; \node [anchor=south,font=\scriptsize] (w8) at (label7.north) {$0.1$};
\node[font=\scriptsize] (line1) at ([xshift=9em,yshift=-1.5em]model_label7.east) {$Loss =-0.3 \log p_{3}-\sum_{i=1}^{7} 0.1 \log p_{i}$}; \node[font=\scriptsize] (line1) at ([xshift=13em,yshift=-1.5em]model_label7.east) {$Loss =-0.3 \log p_{3}-\sum_{i=1}^{7} 0.1 \log p_{i}$};
\node[font=\scriptsize] (line2) at ([xshift=5.9em,yshift=3em]model_label7.east) {$Loss =-\log p_{3}$}; \node[font=\scriptsize] (line2) at ([xshift=9.5em,yshift=3em]model_label7.east) {$Loss =-\log p_{3}$};
\begin{pgfonlayer}{background} \begin{pgfonlayer}{background}
\node [rectangle,inner sep=0.5em,rounded corners=1pt,very thick,dotted,draw=red] [fit =(model_w3) (model_label1) (model_label7) (one_hot_w3)] (box1) {}; \node [rectangle,inner sep=0.5em,rounded corners=1pt,very thick,dotted,draw=red] [fit =(model_w3) (model_label1) (model_label7) (one_hot_w3)] (box1) {};
\node [rectangle,inner sep=0.2em,rounded corners=1pt,fill=purple!10,drop shadow,draw=purple] [fit = (line2)] (box3) {}; \node [rectangle,thick,inner sep=0.2em,rounded corners=1pt,fill=purple!10,drop shadow,draw=purple] [fit = (line2)] (box3) {};
\draw [->,dotted,very thick,red] ([yshift=1em]box1.east) .. controls +(east:1) and +(west:1) .. (box3.west); \draw [->,dotted,very thick,red] ([yshift=2em]box1.east) .. controls +(east:1.7) and +(west:1.5) .. (box3.west);
\node [rectangle,inner sep=0.7em,rounded corners=1pt,very thick,dotted,draw=ugreen] [fit =(w3) (label1) (label7) (model_w3)] (box2) {}; \node [rectangle,inner sep=0.7em,rounded corners=1pt,very thick,dotted,draw=ugreen] [fit =(w3) (label1) (label7) (model_w3)] (box2) {};
\node [rectangle,inner sep=0.2em,rounded corners=1pt,fill=green!10,drop shadow,draw=ugreen] [fit = (line1)] (box4) {}; \node [rectangle,thick,inner sep=0.2em,rounded corners=1pt,fill=green!10,drop shadow,draw=ugreen] [fit = (line1)] (box4) {};
\draw [->,dotted,very thick,ugreen] ([yshift=-1.5em]box2.east) .. controls +(east:1) and +(west:1) .. (box4.west); \draw [->,dotted,very thick,ugreen] ([yshift=-2.5em]box2.east) .. controls +(east:1.7) and +(west:1.5) .. (box4.west);
\end{pgfonlayer} \end{pgfonlayer}
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
\begin{tikzpicture} \begin{tikzpicture}
\def\neuronsep{1} \def\neuronsep{1}
\tikzstyle{neuronnode} = [minimum size=1.0em,circle,draw,thick,ublue,inner sep=1pt, fill=white,align=center] \tikzstyle{neuronnode} = [minimum size=1em,circle,draw,thick,ublue,inner sep=1pt, fill=white,align=center]
%standard %standard
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
\begin{tikzpicture} \begin{tikzpicture}
\tikzstyle{rnnnode} = [draw,inner sep=2pt,minimum width=4em,minimum height=2em,rounded corners=1pt,fill=red!15] \tikzstyle{rnnnode} = [draw,thick,inner sep=2pt,minimum width=4em,minimum height=2em,rounded corners=1pt,fill=red!15]
\tikzstyle{snode} = [draw,inner sep=2pt,minimum width=4em,minimum height=2em,rounded corners=1pt,fill=blue!15] \tikzstyle{snode} = [draw,thick,inner sep=2pt,minimum width=4em,minimum height=2em,rounded corners=1pt,fill=blue!15]
\tikzstyle{ynode} = [inner sep=2pt,minimum width=4em,minimum height=2em,rounded corners=1pt] \tikzstyle{ynode} = [inner sep=2pt,minimum width=4em,minimum height=2em,rounded corners=1pt]
...@@ -14,18 +14,18 @@ ...@@ -14,18 +14,18 @@
\node [anchor=west,rnnnode] (n3) at ([xshift=3em,yshift=0em]n2.east) {$\mathbi{h}_{j-1}$}; \node [anchor=west,rnnnode] (n3) at ([xshift=3em,yshift=0em]n2.east) {$\mathbi{h}_{j-1}$};
\node [anchor=west,rnnnode] (n4) at ([xshift=3em,yshift=0em]n3.east) {$\mathbi{h}_{j}$}; \node [anchor=west,rnnnode] (n4) at ([xshift=3em,yshift=0em]n3.east) {$\mathbi{h}_{j}$};
\node [anchor=south,snode] (n5) at ([xshift=0em,yshift=1em]n3.north) {Softmax}; \node [anchor=south,snode] (n5) at ([xshift=0em,yshift=1em]n3.north) {Softmax};
\node [anchor=south,ynode] (n6) at ([xshift=0em,yshift=1em]n5.north) {$\hat{{y}}_{j-1}$}; \node [anchor=south,ynode,fill=green!20] (n6) at ([xshift=0em,yshift=1em]n5.north) {$\hat{{y}}_{j-1}$};
\node [anchor=south,snode] (n7) at ([xshift=0em,yshift=1em]n4.north) {Softmax}; \node [anchor=south,snode] (n7) at ([xshift=0em,yshift=1em]n4.north) {Softmax};
\node [anchor=south,ynode] (n8) at ([xshift=0em,yshift=1em]n7.north) {$\hat{{y}}_{j}$}; \node [anchor=south,ynode] (n8) at ([xshift=0em,yshift=1em]n7.north) {$\hat{{y}}_{j}$};
\node [anchor=south,snode,font=\footnotesize] (n13) at ([xshift=0em,yshift=1em]n1.north) {Softmax}; \node [anchor=south,snode] (n13) at ([xshift=0em,yshift=1em]n1.north) {Softmax};
\node [anchor=south,ynode] (n14) at ([xshift=0em,yshift=1em]n13.north) {$\hat{{y}}_{1}$}; \node [anchor=south,ynode] (n14) at ([xshift=0em,yshift=1em]n13.north) {$\hat{{y}}_{1}$};
\node [anchor=north] (x1) at ([xshift=0em,yshift=-1em]n1.south) {$\langle$sos$\rangle$}; \node [anchor=north] (x1) at ([xshift=0em,yshift=-1em]n1.south) {$\langle$sos$\rangle$};
\node [anchor=north,font=\small] (x2) at ([xshift=-1.3em,yshift=-2.3em]n3.south) {$\hat{{y}}_{j-2}$}; \node [anchor=north,font=\small] (x2) at ([xshift=-1.3em,yshift=-2.3em]n3.south) {$\hat{{y}}_{j-2}$};
\node [anchor=north,font=\small] (x3) at ([xshift=1.3em,yshift=-2.5em]n3.south) {${y}_{j-2}$}; \node [anchor=north,font=\small] (x3) at ([xshift=1.3em,yshift=-2.5em]n3.south) {${y}_{j-2}$};
\node [anchor=north,font=\small] (x4) at ([xshift=1.3em,yshift=-2.5em]n4.south) {${y}_{j-1}$}; \node [anchor=north,font=\small] (x4) at ([xshift=1.3em,yshift=-2.5em]n4.south) {${y}_{j-1}$};
\node [anchor=north,font=\small] (x5) at ([xshift=-1.3em,yshift=-2.3em]n4.south) {$\hat{{y}}_{j-1}$}; \node [anchor=north,font=\small,fill=green!20] (x5) at ([xshift=-1.3em,yshift=-2.3em]n4.south) {$\hat{{y}}_{j-1}$};
\node [anchor=south,inner sep=2pt] (st1) at (n6.north) {\scriptsize{\textbf{[step $j-1$]}}}; \node [anchor=south,inner sep=2pt] (st1) at (n6.north) {\scriptsize{\textbf{[step $j-1$]}}};
\node [anchor=south,inner sep=2pt] (st2) at (n8.north) {\scriptsize{\textbf{[step $j$]}}}; \node [anchor=south,inner sep=2pt] (st2) at (n8.north) {\scriptsize{\textbf{[step $j$]}}};
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
\draw [-,thick] ([xshift=0em,yshift=0.2em]x4.north)-- ([xshift=1.3em,yshift=0em]n4.south); \draw [-,thick] ([xshift=0em,yshift=0.2em]x4.north)-- ([xshift=1.3em,yshift=0em]n4.south);
\draw [->,thick,dotted] ([xshift=-2.5em,yshift=1em]x2.north) .. controls +(south:2em) and +(west:0.1em) .. ([xshift=0.2em,yshift=0em]x2.west); \draw [->,thick,dotted] ([xshift=-2.5em,yshift=1em]x2.north) .. controls +(south:2em) and +(west:0.1em) .. ([xshift=0.2em,yshift=0em]x2.west);
\draw [->,thick,dotted] ([xshift=0em,yshift=0em]n6.east) .. controls ([xshift=2em,yshift=1em]n6.east) and ([xshift=-2.5em,yshift=-4em]n4.south west) .. ([xshift=-0em,yshift=-0em]x5.west); \draw [->,thick,dotted,ugreen] ([xshift=0em,yshift=0em]n6.east) .. controls +(east:2.5em) and +(west:2.5em) .. ([xshift=-0em,yshift=-0em]x5.west);
\draw [->,thick,dotted] ([xshift=0em,yshift=0em]n14.east) .. controls +(east:0.3em) and +(north:2em) .. ([xshift=3em,yshift=-0.5em]n14.south); \draw [->,thick,dotted] ([xshift=0em,yshift=0em]n14.east) .. controls +(east:0.3em) and +(north:1.5em) .. ([xshift=3em,yshift=-0.5em]n14.south);
\end{tikzpicture} \end{tikzpicture}
\begin{tikzpicture} \begin{tikzpicture}
\node[anchor=west,inner sep=0mm,minimum height=4em,minimum width=5.5em,rounded corners=15pt,align=left,draw,fill=red!15] (n1) at (0,0) {Decoder\\Encoder}; \node[anchor=west,thick,inner sep=0mm,minimum height=4em,minimum width=5.5em,rounded corners=15pt,align=left,draw,fill=red!15] (n1) at (0,0) {Decoder\\Encoder};
\node[anchor=west,inner sep=0mm,minimum height=4em,minimum width=5.5em,rounded corners=15pt,align=left,draw,fill=green!15] (n2) at ([xshift=10em,yshift=0em]n1.east) {Decoder\\Encoder}; \node[anchor=west,thick,inner sep=0mm,minimum height=4em,minimum width=5.5em,rounded corners=15pt,align=left,draw,fill=green!15] (n2) at ([xshift=10em,yshift=0em]n1.east) {Decoder\\Encoder};
\node[anchor=south,inner sep=0mm,font=\small] (a1) at ([xshift=0em,yshift=1em]n1.north) {演员$p$}; \node[anchor=south,inner sep=0mm,font=\small] (a1) at ([xshift=0em,yshift=1em]n1.north) {演员$p$};
......
\begin{tabular}{l l l} \begin{tabular}{l l l l l}
\begin{tikzpicture} \begin{tikzpicture}
\draw[->, thick] (0,0) to (3,0); \draw[->, thick] (0,0) to (3,0);
\draw[->, thick] (0,-0) to (0,2); \draw[->, thick] (0,-0) to (0,2);
...@@ -25,6 +25,10 @@ ...@@ -25,6 +25,10 @@
\node [font=\footnotesize] at (1.5,-0.5) {欠拟合}; \node [font=\footnotesize] at (1.5,-0.5) {欠拟合};
\end{tikzpicture} \end{tikzpicture}
&
\hspace{3em}
&\begin{tikzpicture} &\begin{tikzpicture}
\draw[->, thick] (0,0) to (3,0); \draw[->, thick] (0,0) to (3,0);
\draw[->, thick] (0,-0) to (0,2); \draw[->, thick] (0,-0) to (0,2);
...@@ -52,6 +56,10 @@ ...@@ -52,6 +56,10 @@
\node [font=\footnotesize] at (1.5,-0.5) {拟合合适}; \node [font=\footnotesize] at (1.5,-0.5) {拟合合适};
\end{tikzpicture} \end{tikzpicture}
&
\hspace{3em}
&\begin{tikzpicture} &\begin{tikzpicture}
\draw[->, thick] (0,0) to (3,0); \draw[->, thick] (0,0) to (3,0);
\draw[->, thick] (0,-0) to (0,2); \draw[->, thick] (0,-0) to (0,2);
......
\begin{tikzpicture} \begin{tikzpicture}
\node[rounded corners=3pt,minimum width=1.0em,minimum height=2.0em,font=\scriptsize,fill=green!5,drop shadow,thick](top) at (0,0) { \node[rounded corners=3pt,minimum width=1.0em,minimum height=2.0em,font=\scriptsize,fill=red!10,drop shadow,thick](top) at (0,0) {
\begin{tabular}{lllllll} \begin{tabular}{lllllll}
\multicolumn{7}{c}{符号合并表} \\ \multicolumn{7}{c}{符号合并表} \\
r\ $<$e$>$, & e\ s, & l\ o, & es\ t, & lo\ w, & est\ $<$e$>$, & e\ r$<$e$>$, r\ $<$e$>$, & e\ s, & l\ o, & es\ t, & lo\ w, & est\ $<$e$>$, & e\ r$<$e$>$,
......
...@@ -52,18 +52,7 @@ ...@@ -52,18 +52,7 @@
\subsection{大词表和未登录词问题} \subsection{大词表和未登录词问题}
\parinterval 首先来具体看一看神经机器翻译的大词表问题。神经机器翻译模型训练和推断都依赖于源语言和目标语言的词表(见{\chapterten})。在建模中,词表中的每一个单词都会被转换为分布式(向量)表示,即词嵌入。如果每个单词都对应一个向量,那么单词的各种变形(时态、语态等)都会导致词表增大,同时增加词嵌入表示的难度。图\ref{fig:13-1}展示了一些英语单词的时态和语态变化。 \parinterval 首先来具体看一看神经机器翻译的大词表问题。神经机器翻译模型训练和推断都依赖于源语言和目标语言的词表(见{\chapterten})。在建模中,词表中的每一个单词都会被转换为分布式(向量)表示,即词嵌入。如果每个单词都对应一个向量,那么单词的各种变形(时态、语态等)都会导致词表增大,同时增加词嵌入表示的难度。如果要覆盖更多的翻译现象,词表会不断膨胀,并带来两个问题:
%----------------------------------------------
\begin{figure}[htp]
\centering
\input{./Chapter13/Figures/figure-word-change}
\caption{英语单词时态、语态、单复数的变化}
\label{fig:13-1}
\end{figure}
%----------------------------------------------
\parinterval 如果要覆盖更多的翻译现象,词表会不断膨胀,并带来两个问题:
\begin{itemize} \begin{itemize}
\vspace{0.5em} \vspace{0.5em}
...@@ -428,7 +417,7 @@ Loss_{\textrm{robust}}(\theta_{\textrm{mt}}) &=& \frac{1}{N}\sum_{(\mathbi{x},\ ...@@ -428,7 +417,7 @@ Loss_{\textrm{robust}}(\theta_{\textrm{mt}}) &=& \frac{1}{N}\sum_{(\mathbi{x},\
\label{eq:13-12} \label{eq:13-12}
\end{eqnarray} \end{eqnarray}
\parinterval 无论是黑盒方法还是白盒方法,本质上都是通过增加噪声使得模型训练更加健壮。类似的思想在很多机器学习方法中都有体现,比如,最大熵模型中使用高斯噪声就是常用的增加模型健壮性的手段之一\upcite{chen1999gaussian}。从噪声信道模型的角度看(见{\chapterfive}),翻译过程也可以被理解为一种加噪和去噪的过程,不论这种噪声是天然存在于数据中的,还是人为添加的。除了对抗样本训练,机器翻译所使用的降噪自编码方法和基于重构的损失函数({\color{red} 引用降噪自编的论文!还有,Neural Machine Translation with Reconstruction}),也都体现了类似的思想。广义上,这些方法也可以被看作是利用“加噪+ 去噪”进行健壮性训练的方法。 \parinterval 无论是黑盒方法还是白盒方法,本质上都是通过增加噪声使得模型训练更加健壮。类似的思想在很多机器学习方法中都有体现,比如,最大熵模型中使用高斯噪声就是常用的增加模型健壮性的手段之一\upcite{chen1999gaussian}。从噪声信道模型的角度看(见{\chapterfive}),翻译过程也可以被理解为一种加噪和去噪的过程,不论这种噪声是天然存在于数据中的,还是人为添加的。除了对抗样本训练,机器翻译所使用的降噪自编码方法和基于重构的损失函数({\color{red} 引用降噪自编的论文!还有,Neural Machine Translation with Reconstruction}),也都体现了类似的思想。广义上,这些方法也可以被看作是利用“加噪+ 去噪”进行健壮性训练的方法。
%---------------------------------------------------------------------------------------- %----------------------------------------------------------------------------------------
% NEW SECTION % NEW SECTION
...@@ -437,7 +426,7 @@ Loss_{\textrm{robust}}(\theta_{\textrm{mt}}) &=& \frac{1}{N}\sum_{(\mathbi{x},\ ...@@ -437,7 +426,7 @@ Loss_{\textrm{robust}}(\theta_{\textrm{mt}}) &=& \frac{1}{N}\sum_{(\mathbi{x},\
\sectionnewpage \sectionnewpage
\section{学习策略} \section{学习策略}
\parinterval 在神经机器翻译中,极大似然估计是最常用的模型参数估计方法。尽管这种方法取得了巨大的成功,但仍然面临着许多问题。比如,似然函数并不是评价翻译系统性能的指标,这使得即使在训练数据上优化似然函数,但在应用模型时并不一定可以获得更好的翻译结果。本节首先会对极大似然估计的问题进行论述,然后介绍一些解决相关问题的方法。 \parinterval 尽管极大似然估计在神经机器翻译中取得了巨大的成功,但仍然面临着许多问题。比如,似然函数并不是评价翻译系统性能的指标,这使得即使在训练数据上优化似然函数,但在应用模型时并不一定可以获得更好的翻译结果。本节首先会对极大似然估计的问题进行论述,然后介绍一些解决相关问题的方法。
%---------------------------------------------------------------------------------------- %----------------------------------------------------------------------------------------
% NEW SUB-SECTION % NEW SUB-SECTION
...@@ -445,21 +434,21 @@ Loss_{\textrm{robust}}(\theta_{\textrm{mt}}) &=& \frac{1}{N}\sum_{(\mathbi{x},\ ...@@ -445,21 +434,21 @@ Loss_{\textrm{robust}}(\theta_{\textrm{mt}}) &=& \frac{1}{N}\sum_{(\mathbi{x},\
\subsection{极大似然估计的问题}\label{subsec-13.3.1} \subsection{极大似然估计的问题}\label{subsec-13.3.1}
\parinterval 极大似然估计已成为机器翻译乃至整个自然语言处理领域中使用最广泛的训练用目标函数。但是,使用极大似然估存在{\small\bfnew{曝光偏置}}\index{曝光偏置}(Exposure Bias\index{Exposure Bias})问题和训练-推断评价指标不一致问题具体体现在如下两个方面。 \parinterval 极大似然估计已成为机器翻译乃至整个自然语言处理领域中使用最广泛的训练用目标函数。但是,使用极大似然估存在{\small\bfnew{曝光偏置}}\index{曝光偏置}(Exposure Bias\index{Exposure Bias})问题和训练-推断评价指标不一致问题具体体现在如下两个方面。
\parinterval 曝光偏置问题:在训练过程中,模型使用标注数据进行训练,因此模型在预测下一个单词时,解码器的输入是正确的译文片段。也就是,预测单词$y_j$时,系统使用了标准答案$\{{y}_1,...,{y}_{j-1}\}$作为历史信息。但是对新的句子进行翻译时,预测第$j$个单词时使用的是模型自己生成的前$j-1$个单词,即$\{\hat{{y}}_1,...,\hat{{y}}_{j-1}\}$。这意味着,训练时使用的输入数据(目标语言端)与真实翻译时的情况不符,如图\ref{fig:13-9} 所示。由于在训练过程中暴露于标注数据,因此模型可能适应了标注数据,在推断阶段无法很好地适应模型自动生成的数据,这就是曝光偏置问题\upcite{Bengio2015ScheduledSF,Ranzato2016SequenceLT} \parinterval 曝光偏置问题:在训练过程中,模型使用标注数据进行训练,因此模型在预测下一个单词时,解码器的输入是正确的译文片段。也就是,预测$j$个单词时,系统使用了标准答案$\{{y}_1,...,{y}_{j-1}\}$作为历史信息。但是对新的句子进行翻译时,预测第$j$个单词时使用的是模型自己生成的前$j-1$个单词,即$\{\hat{{y}}_1,...,\hat{{y}}_{j-1}\}$。这意味着,训练时使用的输入数据(目标语言端)与真实翻译时的情况不符,如图\ref{fig:13-9} 所示。由于在训练过程中暴露于标注数据,因此模型也适应了标注数据,在推断阶段无法很好地适应模型自动生成的数据,这就是曝光偏置问题\upcite{Bengio2015ScheduledSF,Ranzato2016SequenceLT}
%---------------------------------------------- %----------------------------------------------
\begin{figure}[htp] \begin{figure}[htp]
\centering \centering
\input{./Chapter13/Figures/figure-exposure-bias} \input{./Chapter13/Figures/figure-exposure-bias}
\caption{曝光偏置问题} \caption{曝光偏置问题(基于循环神经网络的翻译模型)}
\label{fig:13-9} \label{fig:13-9}
\end{figure} \end{figure}
%---------------------------------------------- %----------------------------------------------
\parinterval 训练目标函数与任务评价指标不一致问题:在训练数据上使用极大似然估计,而在新数据上进行推断的时候,通常使用BLEU等外部评价指标来评价模型的性能。在机器翻译任务中,这个问题的一种体现是,训练数据上更低的困惑度不一定能带来BLEU的提升。更加理想的情况是,模型应该直接最大化性能评价指标,而不是训练集数据上的似然函数\upcite{DBLP:conf/acl/ShenCHHWSL16}。但是很多模型性能评价指标不可微分,这使得我们无法直接利用基于梯度的方法来优化模型 \parinterval 训练目标函数与任务评价指标不一致问题:在训练数据上使用极大似然估计,而在新数据上进行推断的时候,通常使用BLEU等外部评价指标来评价模型的性能。在机器翻译任务中,这个问题的一种体现是,训练数据上更低的困惑度不一定能带来BLEU的提升。更加理想的情况是,模型应该直接最大化性能评价指标,而不是训练集数据上的似然函数\upcite{DBLP:conf/acl/ShenCHHWSL16}。但是很多模型性能评价指标不可微分,这使得我们无法直接利用基于梯度的方法来优化这些指标
%---------------------------------------------------------------------------------------- %----------------------------------------------------------------------------------------
% NEW SUB-SECTION % NEW SUB-SECTION
...@@ -475,7 +464,7 @@ Loss_{\textrm{robust}}(\theta_{\textrm{mt}}) &=& \frac{1}{N}\sum_{(\mathbi{x},\ ...@@ -475,7 +464,7 @@ Loss_{\textrm{robust}}(\theta_{\textrm{mt}}) &=& \frac{1}{N}\sum_{(\mathbi{x},\
\subsubsection{1. 调度采样} \subsubsection{1. 调度采样}
\parinterval 对于一个目标序列$\seq{y}=\{{y}_1,\ldots,{y}_n\}$,在预测第$j$个单词${y}_j$时,训练过程与推断过程之间的主要区别在于:训练过程中使用标准答案$\{{y}_{1},...,{y}_{j-1}\}$,而推断过程使用的是来自模型本身的预测结果$\{\hat{{y}}_{1},...,\hat{{y}}_{j-1}\}$。此时可以采取一种{\small\bfnew{调度采样}}\index{调度采样}(Scheduled Sampling\index{Scheduled Sampling})机制\upcite{Bengio2015ScheduledSF},在训练中随机决定使用${y}_{j-1}$还是$\hat{{y}}_{j-1}$。 假设训练时使用的是基于小批量的随机梯度下降方法,在第$i$ 个批次中,对序列每一个位置进行预测时以概率$\epsilon_i$使用标准答案,或以概率${1-\epsilon_i}$使用来自模型本身的预测。具体到序列中的一个位置$j$,可以根据模型单词预测的概率进行采样,在$\epsilon_i$控制的调度策略下,同${y}_{j-1}$一起作为输入。此过程如图\ref{fig:13-10}所示,并且这个过程可以很好地与束搜索融合。 \parinterval 对于一个目标语言序列$\seq{y}=\{{y}_1,\ldots,{y}_n\}$,在预测第$j$个单词时,训练过程与推断过程之间的主要区别在于:训练过程中使用标准答案$\{{y}_{1},...,{y}_{j-1}\}$,而推断过程使用的是来自模型本身的预测结果$\{\hat{{y}}_{1},...,\hat{{y}}_{j-1}\}$。此时可以采取一种{\small\bfnew{调度采样}}\index{调度采样}(Scheduled Sampling\index{Scheduled Sampling})机制\upcite{Bengio2015ScheduledSF}。以基于循环神经网络的模型为例,在训练中预测第$j$个单词时,随机决定使用${y}_{j-1}$还是$\hat{{y}}_{j-1}$作为输入。 假设训练时使用的是基于小批量的随机梯度下降方法,在第$i$ 个批次中,对序列每一个位置进行预测时以概率$\epsilon_i$使用标准答案${y}_{j-1}$,或以概率${1-\epsilon_i}$使用来自模型本身的预测$\hat{{y}}_{j-1}$。具体到序列中的一个位置$j$,可以根据模型单词预测的概率进行采样,在$\epsilon_i$控制的调度策略下,同${y}_{j-1}$一起作为输入。此过程如图\ref{fig:13-10}所示,并且这个过程可以很好地与束搜索融合。
%---------------------------------------------- %----------------------------------------------
\begin{figure}[htp] \begin{figure}[htp]
...@@ -486,9 +475,9 @@ Loss_{\textrm{robust}}(\theta_{\textrm{mt}}) &=& \frac{1}{N}\sum_{(\mathbi{x},\ ...@@ -486,9 +475,9 @@ Loss_{\textrm{robust}}(\theta_{\textrm{mt}}) &=& \frac{1}{N}\sum_{(\mathbi{x},\
\end{figure} \end{figure}
%---------------------------------------------- %----------------------------------------------
\parinterval$\epsilon_i=1$时,模型的训练与原始的训练策略完全相同,而当$\epsilon_i=0$时,模型的训练则与推断时使用的策略完全一样。在这里使用到了一种{\small\bfnew{课程学习}}\index{课程学习}(Curriculum Learning)\index{curriculum learning}策略\upcite{DBLP:conf/coling/XuHJFWHJXZ20},该策略认为学习应该循序渐进,从一种状态逐渐过渡到另一种状态。在训练开始时,由于模型训练不充分,因此如果从模型中随机采样,会导致收敛速度非常慢。因此,在模型训练的前期,通常会选择使用标准答案$\{{y}_{1},...,{y}_{j-1}\}$。在模型训练的后期,应该更倾向于使用自模型本身的预测$\{\hat{{y}}_{1},...,\hat{{y}}_{j-1}\}$。关于课程学习的内容在\ref{sec:curriculum-learning}节还会有详细介绍。 \parinterval$\epsilon_i=1$时,模型的训练与原始的训练策略完全相同,而当$\epsilon_i=0$时,模型的训练则与推断时使用的策略完全一样。在这里使用到了一种{\small\bfnew{课程学习}}\index{课程学习}(Curriculum Learning)\index{curriculum learning}策略\upcite{DBLP:conf/coling/XuHJFWHJXZ20},该策略认为学习应该循序渐进,从一种状态逐渐过渡到另一种状态。在训练开始时,由于模型训练不充分,因此如果使用模型预测结果作为输入,会导致收敛速度非常慢。因此,在模型训练的前期,通常会选择使用标准答案$\{{y}_{1},...,{y}_{j-1}\}$。在模型训练的后期,应该更倾向于使用自模型本身的预测$\{\hat{{y}}_{1},...,\hat{{y}}_{j-1}\}$。关于课程学习的内容在\ref{sec:curriculum-learning}节还会有详细介绍。
\parinterval 在使用调度策略时,需要调整关于$i$的函数来降低$\epsilon_i$,与梯度下降方法中降低学习率的方式相似。调度策略可以采用如下几种方式: \parinterval 在使用调度策略时,需要调整关于训练批次$i$的函数来降低$\epsilon_i$,与梯度下降方法中降低学习率的方式相似。调度策略可以采用如下几种方式:
\begin{itemize} \begin{itemize}
\vspace{0.5em} \vspace{0.5em}
...@@ -506,9 +495,9 @@ Loss_{\textrm{robust}}(\theta_{\textrm{mt}}) &=& \frac{1}{N}\sum_{(\mathbi{x},\ ...@@ -506,9 +495,9 @@ Loss_{\textrm{robust}}(\theta_{\textrm{mt}}) &=& \frac{1}{N}\sum_{(\mathbi{x},\
\subsubsection{2. 生成对抗网络} \subsubsection{2. 生成对抗网络}
\parinterval 调度采样解决曝光偏置的方法是:把模型前$j-1$步的预测结果作为输入,来预测第$j$步的输出。但是,如果模型预测的结果中有错误,再使用错误的结果预测未来的序列也会产生问题。这里面的核心问题是,如何知道模型预测的好与坏,并在训练中有效的使用它们。如果生成好的结果,那么可以使用它进行模型训练,否则就不使用。生成对抗网络就是这样一种技术,它引入了一个额外的模型(判别器)来对原有模型(生成器)的生成结果进行评价,并根据评价结果同时训练两个模型。 \parinterval 调度采样解决曝光偏置的方法是,把模型前$j-1$步的预测结果作为输入,来预测第$j$步的输出。但是,如果模型预测的结果中有错误,再使用错误的结果预测未来的序列也会产生问题。解决这个问题就需要知道模型预测的好与坏,并在训练中有效的使用它们。如果生成好的结果,那么可以使用它进行模型训练,否则就不使用。生成对抗网络就是这样一种技术,它引入了一个额外的模型(判别器)来对原有模型(生成器)的生成结果进行评价,并根据评价结果同时训练两个模型。
\parinterval\ref{sec:adversarial-examples}小节已经提到了生成对抗网络,这里进行一些展开。 在机器翻译中,基于对抗神经网络的架构被命名为{\small\bfnew{对抗神经机器翻译}}\index{对抗神经机器翻译}(Adversarial-NMT)\index{Adversarial-NMT}\upcite{DBLP:conf/acml/WuXTZQLL18}。这里,令$(\seq{x},\seq{y})$表示一个训练样本,令$\hat{\seq{y}}$ 表示神经机器翻译系统对源语言句子$\seq{x}$ 的翻译结果。此时,对抗神经机器翻译的总体框架可以表示为图\ref{fig:13-11},其中。绿色部分表示神经机器翻译模型$G$,该模型将源语言句子$\seq{x}$翻译为目标语言句子$\hat{\seq{y}}$。红色部分是对抗网络$D$,它的作用是判断目标语言句子是否是源语言句子$\seq{x}$ 的真实翻译。$G$$D$相互对抗,同时生成翻译结果$\hat{\seq{y}}$来训练$D$,并生成奖励信号来通过策略梯度训练$G$ \parinterval\ref{sec:adversarial-examples}小节已经提到了生成对抗网络,这里稍微进行一些展开。 在机器翻译中,基于对抗神经网络的架构被命名为{\small\bfnew{对抗神经机器翻译}}\index{对抗神经机器翻译}(Adversarial-NMT)\index{Adversarial-NMT}\upcite{DBLP:conf/acml/WuXTZQLL18}。这里,令$(\seq{x},\seq{y})$表示一个训练样本,令$\hat{\seq{y}}$ 表示神经机器翻译系统对源语言句子$\seq{x}$ 的翻译结果。此时,对抗神经机器翻译的总体框架可以表示为图\ref{fig:13-11},其中。绿色部分表示神经机器翻译模型$G$,该模型将源语言句子$\seq{x}$翻译为目标语言句子$\hat{\seq{y}}$。红色部分是对抗网络$D$,它的作用是判断目标语言句子是否是源语言句子$\seq{x}$ 的真实翻译。$G$$D$相互对抗,同时生成翻译结果$\hat{\seq{y}}$来训练$D$,并生成奖励信号来通过策略梯度训练$G$
%---------------------------------------------- %----------------------------------------------
\begin{figure}[htp] \begin{figure}[htp]
...@@ -527,7 +516,7 @@ Loss_{\textrm{robust}}(\theta_{\textrm{mt}}) &=& \frac{1}{N}\sum_{(\mathbi{x},\ ...@@ -527,7 +516,7 @@ Loss_{\textrm{robust}}(\theta_{\textrm{mt}}) &=& \frac{1}{N}\sum_{(\mathbi{x},\
\subsection{强化学习方法} \subsection{强化学习方法}
\parinterval {\small\bfnew{强化学习}}\index{强化学习}(Reinforcement Learning\index{Reinforcement Learning},RL)方法是机器学习中的经典方法,它可以同时解决\ref{subsec-13.3.1}节提到的曝光偏置问题和训练-推断评价指标不一致问题。本节主要介绍基于策略的方法和基于演员-评论家的强化学习方法\upcite{DBLP:conf/iclr/BahdanauBXGLPCB17} \parinterval {\small\bfnew{强化学习}}\index{强化学习}(Reinforcement Learning\index{Reinforcement Learning},RL)方法是机器学习中的经典方法,它可以同时解决\ref{subsec-13.3.1}节提到的曝光偏置问题和训练-推断评价指标不一致问题。本节主要介绍基于策略的方法和基于演员-评论家的方法\upcite{DBLP:conf/iclr/BahdanauBXGLPCB17}
%---------------------------------------------------------------------------------------- %----------------------------------------------------------------------------------------
% NEW SUBSUB-SECTION % NEW SUBSUB-SECTION
...@@ -537,27 +526,29 @@ Loss_{\textrm{robust}}(\theta_{\textrm{mt}}) &=& \frac{1}{N}\sum_{(\mathbi{x},\ ...@@ -537,27 +526,29 @@ Loss_{\textrm{robust}}(\theta_{\textrm{mt}}) &=& \frac{1}{N}\sum_{(\mathbi{x},\
\parinterval {\small\bfnew{最小风险训练}}\index{最小风险训练}(Minimum Risk Training\index{Minimum Risk Training},MRT)可以被看作是一种基于策略的方法。与极大似然估计不同,最小风险训练引入了评价指标作为损失函数,并优化模型将预期风险降至最低\upcite{DBLP:conf/acl/ShenCHHWSL16} \parinterval {\small\bfnew{最小风险训练}}\index{最小风险训练}(Minimum Risk Training\index{Minimum Risk Training},MRT)可以被看作是一种基于策略的方法。与极大似然估计不同,最小风险训练引入了评价指标作为损失函数,并优化模型将预期风险降至最低\upcite{DBLP:conf/acl/ShenCHHWSL16}
\parinterval 假设有$N$个训练样本$\{(x^{[1]},y^{[1]}),...,(x^{[N]},y^{[N]})\}$最小风险训练的目标是找到模型参数$\hat{\theta}_{\textrm{MRT}} $,满足如下公式: \parinterval 最小风险训练的目标是找到模型参数$\hat{\theta}_{\textrm{MRT}} $,满足如下公式:
\begin{eqnarray} \begin{eqnarray}
\hat{\theta}_{\textrm{MRT}} & = & \argmax_{\theta}\{\funp{R}(\theta)\} \label{eq:13-13} \hat{\theta}_{\textrm{MRT}} & = & \argmax_{\theta}\{\funp{R}(\theta)\} \label{eq:13-13}
\end{eqnarray} \end{eqnarray}
\noindent 其中,$\funp{R}(\theta)$表示预期风险,通常用风险函数的期望表示,公式如下: \noindent 其中,$\funp{R}(\theta)$表示预期风险,通常用风险函数的期望表示。假设有$N$个训练样本$\{(x^{[1]},y^{[1]}),...,(x^{[N]},y^{[N]})\}$$\funp{R}(\theta)$被定义如下:
\begin{eqnarray} \begin{eqnarray}
\funp{R}(\theta) & = & \sum_{k=1}^N \mathbb{E}_{\hat{\seq{y}}|\seq{x}^{[k]};\theta}[\vartriangle(\hat{\seq{y}},\seq{y}^{[k]})] \nonumber \\ \funp{R}(\theta) & = & \sum_{k=1}^N \mathbb{E}_{\hat{\seq{y}}|\seq{x}^{[k]};\theta}[\vartriangle(\hat{\seq{y}},\seq{y}^{[k]})] \nonumber \\
& = & \sum_{k=1}^N \sum_{\hat{\seq{y}} \in \chi(\seq{x}^{[k]})}\funp{P}(\hat{\seq{y}}|\seq{x}^{[k]};\theta)\vartriangle(\hat{\seq{y}},\seq{y}^{[k]}) & = & \sum_{k=1}^N \sum_{\hat{\seq{y}} \in \chi(\seq{x}^{[k]})}\funp{P}(\hat{\seq{y}}|\seq{x}^{[k]};\theta)\vartriangle(\hat{\seq{y}},\seq{y}^{[k]})
\label{eq:13-14} \label{eq:13-14}
\end{eqnarray} \end{eqnarray}
\noindent 这里,$\hat{\seq{y}}$是模型预测的译文,$\chi(\seq{x}^{[k]})$$\seq{x}^{[k]}$所对应的所有候选翻译的集合。损失函数$\vartriangle(\hat{\seq{y}},\seq{y}^{[k]})$用来衡量模型预测$\hat{\seq{y}}$与标准答案$\seq{y}^{[k]}$间的差异,损失函数一般用翻译质量评价指标定义,例如,BLEU,TER等。在最小风险训练中,对模型参数$\theta$的偏导数为: \noindent 这里,$\hat{\seq{y}}$是模型预测的译文,$\chi(\seq{x}^{[k]})$$\seq{x}^{[k]}$所对应的所有候选翻译的集合。损失函数$\vartriangle(\hat{\seq{y}},\seq{y}^{[k]})$用来衡量模型预测$\hat{\seq{y}}$与标准答案$\seq{y}^{[k]}$间的差异,损失函数一般用翻译质量评价指标定义,例如,BLEU,TER等\footnote{对于BLEU,损失函数可以被定义为$1-$BLEU。}。在最小风险训练中,对模型参数$\theta$的偏导数为:
\begin{eqnarray} \begin{eqnarray}
\frac{\partial \funp{R}(\theta)}{\partial \theta} & = & \sum_{k=1}^N \mathbb{E}_{\hat{\seq{y}}|\seq{x}^{[k]};\theta}[\vartriangle(\hat{\seq{y}},\seq{y}^{[k]}) \times \frac{\partial \funp{P}(\hat{\seq{y}}|\seq{x}^{[k]};\theta)/\partial \theta}{\funp{P}(\hat{\seq{y}}|\seq{x}^{[k]};\theta)}] \frac{\partial \funp{R}(\theta)}{\partial \theta} & = & \sum_{k=1}^N \mathbb{E}_{\hat{\seq{y}}|\seq{x}^{[k]};\theta}[\vartriangle(\hat{\seq{y}},\seq{y}^{[k]}) \times \frac{\partial \funp{P}(\hat{\seq{y}}|\seq{x}^{[k]};\theta)/\partial \theta}{\funp{P}(\hat{\seq{y}}|\seq{x}^{[k]};\theta)}]
\label{eq:13-15} \label{eq:13-15}
\end{eqnarray} \end{eqnarray}
\noindent 公式\eqref{eq:13-15}使用了{\small\bfnew{策略梯度}}\index{策略梯度}(Policy Gradient\index{Policy Gradient})的手段将$\vartriangle(\hat{\seq{y}},\seq{y}^{[k]})$提到微分操作之外\upcite{DBLP:conf/nips/Kakade01,DBLP:journals/corr/abs-1810-02525}。这样,就无需对$\vartriangle(\hat{\seq{y}},\seq{y}^{[k]})$进行微分,因此最小风险训练允许任意不可微的损失函数,包括BLEU等常用的评价函数。使用公式\eqref{eq:13-15}就可以求出模型参数相对于风险函数的损失,进而进行基于梯度的优化。这里需要注意的是,公式\eqref{eq:13-15}中求期望的过程是无法直接实现的,因为无法遍历所有的译文句子。通常,会使用采样的方法搜集一定数量的译文,来模拟译文空间。例如,可以使用推断系统生成若干译文。同时,为了保证生成的译文之间具有一定的差异性,也可以对推断过程进行一些“干扰”。从实践的角度看,采样方法是影响强化学习系统的重要因素,因此往往需要对不同的任务设计相适应的采样方法。{\red 实际上,对于翻译模型来说,随机采样句子的方法有很多。最简单的方法就是在产生译文的每一个词时候,根据模型产生的下一个词的分布随机选取词当作模型预测,直到选到句子结束符或者达到特定长度的时候停止\upcite{DBLP:conf/emnlp/EdunovOAG18}。其他方法还包括随机束搜索,它把束搜索中选取top-$k$的操作替换成随机选取$k$个词。这个方法不会采集到重复的样本;基于Gumbel-Top-$k$的随机束搜索在普通的随机束搜索的基础上更好地控制了样本里的噪声\upcite{DBLP:conf/icml/KoolHW19}。(新增内容)} \noindent 公式\eqref{eq:13-15}使用了{\small\bfnew{策略梯度}}\index{策略梯度}(Policy Gradient\index{Policy Gradient})的手段将$\vartriangle(\hat{\seq{y}},\seq{y}^{[k]})$提到微分操作之外\upcite{DBLP:conf/nips/Kakade01,DBLP:journals/corr/abs-1810-02525}。这样,就无需对$\vartriangle(\hat{\seq{y}},\seq{y}^{[k]})$进行微分,因此最小风险训练允许任意不可微的损失函数,包括BLEU等常用的评价函数。使用公式\eqref{eq:13-15}就可以求出模型参数相对于风险函数的损失,进而进行基于梯度的优化。
\parinterval 这里需要注意的是,公式\eqref{eq:13-15}中求期望的过程是无法直接实现的,因为无法遍历所有的译文句子。通常,会使用采样的方法搜集一定数量的译文,来模拟译文空间。例如,可以使用推断系统生成若干译文。同时,为了保证生成的译文之间具有一定的差异性,也可以对推断过程进行一些“干扰”。从实践的角度看,采样方法是影响强化学习系统的重要因素,因此往往需要对不同的任务设计相适应的采样方法。{\red 最简单的方法就是在产生译文的每一个词时候,根据模型产生的下一个词的分布随机选取词当作模型预测,直到选到句子结束符或者达到特定长度的时候停止\upcite{DBLP:conf/emnlp/EdunovOAG18}。其他方法还包括随机束搜索,它把束搜索中选取Top-$k$的操作替换成随机选取$k$个词。这个方法不会采集到重复的样本。还可以使用基于Gumbel-Top-$k$的随机束搜索更好地控制了样本里的噪声\upcite{DBLP:conf/icml/KoolHW19}}
\parinterval 相比于大似然估计,最小风险训练有着以下优点: \parinterval 相比于大似然估计,最小风险训练有着以下优点:
\begin{itemize} \begin{itemize}
\vspace{0.5em} \vspace{0.5em}
...@@ -582,7 +573,7 @@ Loss_{\textrm{robust}}(\theta_{\textrm{mt}}) &=& \frac{1}{N}\sum_{(\mathbi{x},\ ...@@ -582,7 +573,7 @@ Loss_{\textrm{robust}}(\theta_{\textrm{mt}}) &=& \frac{1}{N}\sum_{(\mathbi{x},\
\label{eq:13-16} \label{eq:13-16}
\end{eqnarray} \end{eqnarray}
\noindent 其中,$\funp{r}_j(a;\hat{{y}}_{1 \ldots j-1},\seq{y})$$j$时刻做出行动$a$获得的奖励,$\funp{r}_i(\hat{{y}}_i;\hat{{y}}_{1 \ldots j-1}a\hat{{y}}_{j+1 \ldots i-1},\seq{y})$z在$j$时刻的行动为$a$的前提下,$i$时刻的做出行动$\hat{{y}}_i$获得的奖励。$\seq{x}$是源语言句子,$\seq{y}$是正确译文,$\hat{{y}}_{1 \ldots j}$是策略$\funp{p}$产生的译文的前$j$个词,$J$是生成译文的长度。对于源语句子$x$,最优策略$\hat{p}$可以被定义为: \noindent 其中,$\funp{r}_j(a;\hat{{y}}_{1 \ldots j-1},\seq{y})$$j$时刻做出行动$a$获得的奖励,$\funp{r}_i(\hat{{y}}_i;\hat{{y}}_{1 \ldots j-1}a\hat{{y}}_{j+1 \ldots i-1},\seq{y})$$j$时刻的行动为$a$的前提下,$i$时刻的做出行动$\hat{{y}}_i$获得的奖励,$\seq{x}$是源语言句子,$\seq{y}$是正确译文,$\hat{{y}}_{1 \ldots j}$是策略$\funp{p}$产生的译文的前$j$个词,$J$是生成译文的长度。对于源语句子$x$,最优策略$\hat{p}$可以被定义为:
\begin{eqnarray} \begin{eqnarray}
\hat{p} & = & \argmax_{\funp{p}}\mathbb{E}_{\hat{\seq{y}} \sim \funp{p}(\hat{\seq{y}} | \seq{x})}\sum_{j=1}^J\sum_{a \in A}\funp{p}(a|\hat{{y}}_{1 \ldots j},\seq{x})\funp{Q}(a;\hat{{y}}_{1 \ldots j},\seq{y}) \hat{p} & = & \argmax_{\funp{p}}\mathbb{E}_{\hat{\seq{y}} \sim \funp{p}(\hat{\seq{y}} | \seq{x})}\sum_{j=1}^J\sum_{a \in A}\funp{p}(a|\hat{{y}}_{1 \ldots j},\seq{x})\funp{Q}(a;\hat{{y}}_{1 \ldots j},\seq{y})
\label{eq:13-17} \label{eq:13-17}
...@@ -594,13 +585,13 @@ Loss_{\textrm{robust}}(\theta_{\textrm{mt}}) &=& \frac{1}{N}\sum_{(\mathbi{x},\ ...@@ -594,13 +585,13 @@ Loss_{\textrm{robust}}(\theta_{\textrm{mt}}) &=& \frac{1}{N}\sum_{(\mathbi{x},\
\parinterval 为了避免采样的开销和随机性带来的不稳定,基于{\small\bfnew{演员-评论家}}\index{演员-评论家}(Actor-critic\index{Actor-critic})的强化学习方法引入一个可学习的函数$\tilde{\funp{Q}}$,通过函数$\tilde{\funp{Q}}$来逼近动作价值函数$\funp{Q}$\upcite{DBLP:conf/iclr/BahdanauBXGLPCB17}。但是由于$\tilde{\funp{Q}}$是人工设计的一个函数,该函数有着自身的偏置,因此$\tilde{\funp{Q}}$不是$\funp{Q}$的一个无偏估计,所以使用$\tilde{\funp{Q}}$来指导$\funp{p}$的优化无法到达理论上的最优解。尽管如此,得益于神经网络强大的拟合能力,基于演员-评论家的强化学习方法在实践中仍然非常流行。 \parinterval 为了避免采样的开销和随机性带来的不稳定,基于{\small\bfnew{演员-评论家}}\index{演员-评论家}(Actor-critic\index{Actor-critic})的强化学习方法引入一个可学习的函数$\tilde{\funp{Q}}$,通过函数$\tilde{\funp{Q}}$来逼近动作价值函数$\funp{Q}$\upcite{DBLP:conf/iclr/BahdanauBXGLPCB17}。但是由于$\tilde{\funp{Q}}$是人工设计的一个函数,该函数有着自身的偏置,因此$\tilde{\funp{Q}}$不是$\funp{Q}$的一个无偏估计,所以使用$\tilde{\funp{Q}}$来指导$\funp{p}$的优化无法到达理论上的最优解。尽管如此,得益于神经网络强大的拟合能力,基于演员-评论家的强化学习方法在实践中仍然非常流行。
\parinterval 对于基于演员-评论家的强化学习方法,演员就是策略$\funp{p}$,而评论家就是动作价值函数$\funp{Q}$的估计$\tilde{\funp{Q}}$。对于演员,它的目标是找到最优的决策: \parinterval 在基于演员-评论家的强化学习方法中,演员就是策略$\funp{p}$,而评论家就是动作价值函数$\funp{Q}$的估计$\tilde{\funp{Q}}$。对于演员,它的目标是找到最优的决策:
\begin{eqnarray} \begin{eqnarray}
\hat{p} & = & \argmax_{\funp{p}}\mathbb{E}_{\hat{\seq{y}} \sim \funp{p}(\hat{\seq{y}} | \seq{x})}\sum_{j=1}^J\sum_{a \in A}\funp{p}(a|\hat{{y}}_{1 \ldots j},\seq{x})\tilde{\funp{Q}}(a;\hat{{y}}_{1 \ldots j},\seq{y}) \hat{p} & = & \argmax_{\funp{p}}\mathbb{E}_{\hat{\seq{y}} \sim \funp{p}(\hat{\seq{y}} | \seq{x})}\sum_{j=1}^J\sum_{a \in A}\funp{p}(a|\hat{{y}}_{1 \ldots j},\seq{x})\tilde{\funp{Q}}(a;\hat{{y}}_{1 \ldots j},\seq{y})
\label{eq:13-18} \label{eq:13-18}
\end{eqnarray} \end{eqnarray}
\parinterval 与公式\eqref{eq:13-17}对比可以发现,基于演员-评论家的强化学习方法与基于策略的强化学习方法类似,公式\eqref{eq:13-18}对动作价值函数$\funp{Q}$的估计从采样换成了一个可学习的函数$\tilde{\funp{Q}}$。对于目标函数里期望的计算,通常使用采样的方式来进行逼近,这与最小风险训练也是十分类似的,例如,选择一定量的$\hat{y}$来计算期望,而不是遍历所有的$\hat{y}$。借助与最小风险训练类似的方法,可以计算对$\funp{p}$的梯度来优化演员。 \parinterval 与公式\eqref{eq:13-17}对比可以发现,基于演员-评论家的强化学习方法与基于策略的强化学习方法类似,公式\eqref{eq:13-18}对动作价值函数$\funp{Q}$的估计成了一个可学习的函数$\tilde{\funp{Q}}$。对于目标函数里期望的计算,通常使用采样的方式来进行逼近,这与最小风险训练也是十分类似的,例如,选择一定量的$\hat{y}$来计算期望,而不是遍历所有的$\hat{y}$。借助与最小风险训练类似的方法,可以计算对$\funp{p}$的梯度来优化演员。
\parinterval 而对于评论家,它的优化目标并不是那么显而易见。尽管可以通过采样的方式来估计$\funp{Q}$,然后使用该估计作为目标让$\tilde{\funp{Q}}$进行拟合,但是这样会导致非常高的(采样)代价。同时可以想象,既然有了一个无偏估计,为什么还要用有偏估计$\tilde{\funp{Q}}$呢? \parinterval 而对于评论家,它的优化目标并不是那么显而易见。尽管可以通过采样的方式来估计$\funp{Q}$,然后使用该估计作为目标让$\tilde{\funp{Q}}$进行拟合,但是这样会导致非常高的(采样)代价。同时可以想象,既然有了一个无偏估计,为什么还要用有偏估计$\tilde{\funp{Q}}$呢?
...@@ -611,7 +602,7 @@ Loss_{\textrm{robust}}(\theta_{\textrm{mt}}) &=& \frac{1}{N}\sum_{(\mathbi{x},\ ...@@ -611,7 +602,7 @@ Loss_{\textrm{robust}}(\theta_{\textrm{mt}}) &=& \frac{1}{N}\sum_{(\mathbi{x},\
\label{eq:13-19} \label{eq:13-19}
\end{eqnarray} \end{eqnarray}
\parinterval 这个等式也被称为{\small\bfnew{贝尔曼方程}}\index{贝尔曼方程}(Bellman Equation\index{Bellman Equation}\upcite{sutton2018reinforcement}这个等式告诉我们$j-1$时刻的动作价值函数$\funp{Q}(\hat{{y}}_j;\hat{{y}}_{1 \ldots j-1},\seq{y})$跟下一时刻$j$的动作价值函数$\funp{Q}(a;\hat{{y}}_{1 \ldots j},\seq{y})$之间的关系。因此可以很自然的使用等式右部作为等式左部$\funp{Q}(\hat{{y}}_j;\hat{{y}}_{1 \ldots j-1},\seq{y})$的等价形式。于是,可以定义$j$时刻动作价值函数为: \parinterval 这个等式也被称为{\small\bfnew{贝尔曼方程}}\index{贝尔曼方程}(Bellman Equation\index{Bellman Equation}\upcite{sutton2018reinforcement}告诉我们$j-1$时刻的动作价值函数$\funp{Q}(\hat{{y}}_j;\hat{{y}}_{1 \ldots j-1},\seq{y})$跟下一时刻$j$的动作价值函数$\funp{Q}(a;\hat{{y}}_{1 \ldots j},\seq{y})$之间的关系。因此可以很自然的使用等式右部作为等式左部$\funp{Q}(\hat{{y}}_j;\hat{{y}}_{1 \ldots j-1},\seq{y})$的等价形式。于是,可以定义$j$时刻动作价值函数为:
\begin{eqnarray} \begin{eqnarray}
\funp{q}_j & = & \funp{r}_j(\hat{{y}}_j;\hat{{y}}_{1 \ldots j-1},\seq{y}) + \sum_{a \in A}\funp{p}(a|\hat{{y}}_{1 \ldots j},\seq{x})\tilde{\funp{Q}}(a;\hat{{y}}_{1 \ldots j},\seq{y}) \funp{q}_j & = & \funp{r}_j(\hat{{y}}_j;\hat{{y}}_{1 \ldots j-1},\seq{y}) + \sum_{a \in A}\funp{p}(a|\hat{{y}}_{1 \ldots j},\seq{x})\tilde{\funp{Q}}(a;\hat{{y}}_{1 \ldots j},\seq{y})
\label{eq:13-20} \label{eq:13-20}
...@@ -623,7 +614,7 @@ Loss_{\textrm{robust}}(\theta_{\textrm{mt}}) &=& \frac{1}{N}\sum_{(\mathbi{x},\ ...@@ -623,7 +614,7 @@ Loss_{\textrm{robust}}(\theta_{\textrm{mt}}) &=& \frac{1}{N}\sum_{(\mathbi{x},\
\label{eq:13-21} \label{eq:13-21}
\end{eqnarray} \end{eqnarray}
\parinterval 最后,通过同时优化演员和评论家直到收敛,获得的演员也就是策略$\funp{p}$就是我们期望的翻译模型。图\ref{fig:13-12}展示了演员和评论家的关系。 \parinterval 最后,通过同时优化演员和评论家直到收敛,获得的演员(也就是策略$\funp{p}$就是我们期望的翻译模型。图\ref{fig:13-12}展示了演员和评论家的关系。
%---------------------------------------------- %----------------------------------------------
\begin{figure}[htp] \begin{figure}[htp]
...@@ -640,11 +631,11 @@ Loss_{\textrm{robust}}(\theta_{\textrm{mt}}) &=& \frac{1}{N}\sum_{(\mathbi{x},\ ...@@ -640,11 +631,11 @@ Loss_{\textrm{robust}}(\theta_{\textrm{mt}}) &=& \frac{1}{N}\sum_{(\mathbi{x},\
\vspace{0.5em} \vspace{0.5em}
\item {\small\bfnew{多目标学习}}。演员的优化通常会引入额外的极大似然估计目标函数,同时会使用极大似然估计进行预训练。这样会简化训练,因为随机初始化的演员性能很差,很难获得有效的奖励。同时极大似然估计作为一个额外的正则项也可以防止模型{\red 跑偏},加速收敛。 \item {\small\bfnew{多目标学习}}。演员的优化通常会引入额外的极大似然估计目标函数,同时会使用极大似然估计进行预训练。这样会简化训练,因为随机初始化的演员性能很差,很难获得有效的奖励。同时极大似然估计作为一个额外的正则项也可以防止模型{\red 跑偏},加速收敛。
\vspace{0.5em} \vspace{0.5em}
\item {\small\bfnew{优化目标}}。评论家的优化目标是由自身输出所构造。当模型更新比较快的时候模型的输出变化也会很快,导致构造的优化目标不稳定,影响模型收敛效果。一个解决方案是,在一定更新次数内固定构造优化目标使用的模型,然后再使用比较新的模型来构造后续一定更新次数内的优化目标,如此往复\upcite{DBLP:journals/nature/SilverHMGSDSAPL16} \item {\small\bfnew{优化目标}}。评论家的优化目标是由自身输出所构造。当模型更新比较快的时候模型的输出变化也会很快,导致构造的优化目标不稳定,影响模型收敛效果。一个解决方案是,在一定更新次数内固定构造优化目标使用的模型,然后再使用比较新的模型来构造后续一定更新次数内的优化目标,如此往复\upcite{DBLP:journals/nature/SilverHMGSDSAPL16}
\vspace{0.5em} \vspace{0.5em}
\item {\small\bfnew{方差惩罚}}。在机器翻译中使用强化学习方法的一个问题是动作空间过大,这是由词表过大造成的。因为模型只根据被采样到的结果来进行更新,很多动作很难得到更新,因此对不同动作的动作价值函数估计值会有很大差异。此时,通常会引入一个正则项$C_j = \sum_{a \in A}{(\tilde{\funp{Q}}(a;\hat{{y}}_{1 \ldots j-1},\seq{y}) - \frac{1}{|A|} \sum_{b \in A}\tilde{\funp{Q}}(b;\hat{{y}}_{1 \ldots j-1},\seq{y}))}^2$来约束不同动作的动作函数估计值,使其不会偏离均值太远\upcite{DBLP:conf/icml/ZarembaMJF16} \item {\small\bfnew{方差惩罚}}。在机器翻译中使用强化学习方法的一个问题是动作空间过大,这是由词表过大造成的。因为模型只根据被采样到的结果来进行更新,很多动作很难得到更新,因此对不同动作的动作价值函数估计值会有很大差异。此时,通常会引入一个正则项$C_j = \sum_{a \in A}{(\tilde{\funp{Q}}(a;\hat{{y}}_{1 \ldots j-1},\seq{y}) - \frac{1}{|A|} \sum_{b \in A}\tilde{\funp{Q}}(b;\hat{{y}}_{1 \ldots j-1},\seq{y}))}^2$来约束不同动作的动作函数估计值,使其不会偏离均值太远\upcite{DBLP:conf/icml/ZarembaMJF16}
\vspace{0.5em} \vspace{0.5em}
\item {\small\bfnew{函数塑形}}。在机器翻译里面使用强化学习方法的另一个问题就是奖励的稀疏性。评价指标如BLEU等只能对完整的句子进行打分,也就是奖励只有在句子结尾有值,而在句子中间只能为0。这种情况意味着模型在生成句子的过程中没有任何信号来指导它的行为,从而大大增加了学习难度。常见的解决方案是进行{\small\bfnew{函数塑形}}\index{函数塑形}(Reward Shaping\index{Reward Shaping}),使得奖励在生成句子的过程中变得稠密,同时也不会改变模型的最优解\upcite{DBLP:conf/icml/NgHR99} \item {\small\bfnew{函数塑形}}。在机器翻译里面使用强化学习方法的另一个问题就是奖励的稀疏性。评价指标如BLEU等只能对完整的句子进行打分,也就是奖励只有在句子结尾有值,而在句子中间为0。这种情况意味着模型在生成句子的过程中没有任何信号来指导它的行为,从而大大增加了学习难度。常见的解决方案是进行{\small\bfnew{函数塑形}}\index{函数塑形}(Reward Shaping\index{Reward Shaping}),使得奖励在生成句子的过程中变得稠密,同时也不会改变模型的最优解\upcite{DBLP:conf/icml/NgHR99}
\vspace{0.5em} \vspace{0.5em}
\end{itemize} \end{itemize}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论