

%------------------------------------------------------------

\begin{tikzpicture}

\tikzstyle{prob} = [rectangle,fill=blue!40,text=white,inner sep=0pt,font=\tiny];

\begin{scope}[]

\tikzstyle{rnnnode} = [draw,inner sep=2pt,minimum width=3em,minimum height=1.5em,rounded corners=1pt,fill=red!20]
\tikzstyle{snode} = [draw,inner sep=2pt,minimum width=3em,minimum height=1.5em,rounded corners=1pt,fill=blue!20]
\tikzstyle{ynode} = [inner sep=2pt,minimum width=3em,minimum height=1.5em,rounded corners=1pt]


\node [anchor=west,rnnnode] (n1) at (0,0) {$\mathbi{h}_{1}$};
\node [anchor=west] (n2) at ([xshift=2em,yshift=0em]n1.east) {$\cdots$};
\node [anchor=west,rnnnode] (n3) at ([xshift=2em,yshift=0em]n2.east) {$\mathbi{h}_{j-1}$};
\node [anchor=west,rnnnode] (n4) at ([xshift=2em,yshift=0em]n3.east) {$\mathbi{h}_{j}$};
\node [anchor=south,snode,font=\footnotesize] (n5) at ([xshift=0em,yshift=1em]n3.north) {Softmax};
\node [anchor=south,ynode] (n6) at ([xshift=0em,yshift=1em]n5.north) {$\tilde{{y}}_{j-1}$};
\node [anchor=south,snode,font=\footnotesize] (n7) at ([xshift=0em,yshift=1em]n4.north) {Softmax};
\node [anchor=south,ynode] (n8) at ([xshift=0em,yshift=1em]n7.north) {$\tilde{{y}}_{j}$};
\node [anchor=south,snode,font=\footnotesize] (n13) at ([xshift=0em,yshift=1em]n1.north) {Softmax};
\node [anchor=south,ynode] (n14) at ([xshift=0em,yshift=1em]n13.north) {$\tilde{{y}}_{1}$};

\node [anchor=north] (n11) at ([xshift=0em,yshift=-1em]n3.south) {${{y}}_{j-2}$};
\node [anchor=north] (n12) at ([xshift=0em,yshift=-1em]n4.south) {${{y}}_{j-1}$};

\node [anchor=north] (n9) at ([xshift=0em,yshift=-3em]n4.south) {\small{(a) 训练阶段}};

\node [anchor=north] (x1) at ([xshift=0em,yshift=-1em]n1.south) {$\langle$sos$\rangle$};

\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] (st3) at (n14.north) {\scriptsize{\textbf{[step $1$]}}};


\draw [->,thick] ([xshift=0em,yshift=0em]x1.north)--([xshift=0em,yshift=0em]n1.south);
\draw [->,thick] ([xshift=0em,yshift=0em]n1.east)--([xshift=0em,yshift=0em]n2.west);
\draw [->,thick] ([xshift=0em,yshift=0em]n2.east)--([xshift=0em,yshift=0em]n3.west);
\draw [->,thick] ([xshift=0em,yshift=0em]n3.east)--([xshift=0em,yshift=0em]n4.west);
\draw [->,thick] ([xshift=0em,yshift=0em]n4.east)--([xshift=2em,yshift=0em]n4.east);


\draw [->,thick] ([xshift=0em,yshift=0em]n3.north)--([xshift=0em,yshift=0em]n5.south);
\draw [->,thick] ([xshift=0em,yshift=0em]n5.north)--([xshift=0em,yshift=0em]n6.south);
\draw [->,thick] ([xshift=0em,yshift=0em]n4.north)--([xshift=0em,yshift=0em]n7.south);
\draw [->,thick] ([xshift=0em,yshift=0em]n7.north)--([xshift=0em,yshift=0em]n8.south);
\draw [->,thick] ([xshift=0em,yshift=0em]n1.north)--([xshift=0em,yshift=0em]n13.south);
\draw [->,thick] ([xshift=0em,yshift=0em]n13.north)--([xshift=0em,yshift=0em]n14.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);

\node [anchor=west] (n10) at ([xshift=4em,yshift=1em]n8.east) {真实数据$\seq{y}$：};

\node [anchor=north west] (y1) at ([xshift=0.5em,yshift=-7em]n10.south west) {${y}_{1}$};
\node [anchor=west] (y2) at ([xshift=1em,yshift=0em]y1.east) {${y}_{2}$};
\node [anchor=west] (y3) at ([xshift=1em,yshift=0em]y2.east) {${y}_{3}$};
\node [anchor=west] (y4) at ([xshift=0.5em,yshift=0em]y3.east) {$\ldots$};
\node [anchor=west] (y5) at ([xshift=0.5em,yshift=0em]y4.east) {${y}_{n}$};


\node [anchor=center,prob,minimum size=0.5*1em] (label11) at ([xshift=-0.1em,yshift=1em]y1.north) {.5};
\node [anchor=center,prob,minimum size=0.2em] (label12) at ([xshift=0em,yshift=1.3em]label11.center) {};
\node [anchor=center,prob,minimum size=0.2em] (label13) at ([xshift=0em,yshift=1.3em]label12.center) {};
\node [anchor=center,prob,minimum size=0.7*1em] (label14) at ([xshift=0em,yshift=1.3em]label13.center) {.7};
\node [anchor=center,prob,minimum size=0.2em] (label15) at ([xshift=0em,yshift=1.3em]label14.center) {};
\begin{pgfonlayer}{background}
\node [anchor=center,minimum size=1em,white] (up1) at ([xshift=0em,yshift=0em]label11.center) {};
\node [anchor=center,minimum size=1em,white] (down1) at ([xshift=0em,yshift=0em]label15.center) {};
\node [inner sep=0.3em,draw] [fit = (up1) (down1)] (prob1) {};
\end{pgfonlayer}

\node [anchor=center,prob,minimum size=0.2em] (label21) at ([xshift=-0.1em,yshift=1em]y2.north) {};
\node [anchor=center,prob,minimum size=0.9*1em] (label22) at ([xshift=0em,yshift=1.3em]label21.center) {.9};
\node [anchor=center,prob,minimum size=0.2em] (label23) at ([xshift=0em,yshift=1.3em]label22.center) {};
\node [anchor=center,prob,minimum size=0.2em] (label24) at ([xshift=0em,yshift=1.3em]label23.center) {};
\node [anchor=center,prob,minimum size=0.8*1em] (label25) at ([xshift=0em,yshift=1.3em]label24.center) {.8};
\begin{pgfonlayer}{background}
\node [anchor=center,minimum size=1em,white] (up2) at ([xshift=0em,yshift=0em]label21.center) {};
\node [anchor=center,minimum size=1em,white] (down2) at ([xshift=0em,yshift=0em]label25.center) {};
\node [inner sep=0.3em,draw] [fit = (up2) (down2)] (prob2) {};
\end{pgfonlayer}

\node [anchor=center,prob,minimum size=0.2em] (label31) at ([xshift=-0.1em,yshift=1em]y3.north) {};
\node [anchor=center,prob,minimum size=0.2em] (label32) at ([xshift=0em,yshift=1.3em]label31.center) {};
\node [anchor=center,prob,minimum size=0.2em] (label33) at ([xshift=0em,yshift=1.3em]label32.center) {};
\node [anchor=center,prob,minimum size=0.6*1em] (label34) at ([xshift=0em,yshift=1.3em]label33.center) {.6};
\node [anchor=center,prob,minimum size=0.2em] (label35) at ([xshift=0em,yshift=1.3em]label34.center) {};
\begin{pgfonlayer}{background}
\node [anchor=center,minimum size=1em,white] (up3) at ([xshift=0em,yshift=0em]label31.center) {};
\node [anchor=center,minimum size=1em,white] (down3) at ([xshift=0em,yshift=0em]label35.center) {};
\node [inner sep=0.3em,draw] [fit = (up3) (down3)] (prob3) {};
\end{pgfonlayer}

\node [anchor=center,prob,minimum size=0.5*1em] (label41) at ([xshift=-0.1em,yshift=1em]y5.north) {.5};
\node [anchor=center,prob,minimum size=0.2em] (label42) at ([xshift=0em,yshift=1.3em]label41.center) {};
\node [anchor=center,prob,minimum size=0.8*1em] (label43) at ([xshift=0em,yshift=1.3em]label42.center) {.8};
\node [anchor=center,prob,minimum size=0.2em] (label44) at ([xshift=0em,yshift=1.3em]label43.center) {};
\node [anchor=center,prob,minimum size=0.2em] (label45) at ([xshift=0em,yshift=1.3em]label44.center) {};
\begin{pgfonlayer}{background}
\node [anchor=center,minimum size=1em,white] (up4) at ([xshift=0em,yshift=0em]label41.center) {};
\node [anchor=center,minimum size=1em,white] (down4) at ([xshift=0em,yshift=0em]label45.center) {};
\node [inner sep=0.3em,draw] [fit = (up4) (down4)] (prob4) {};
\end{pgfonlayer}


\begin{pgfonlayer}{background}

\node [rectangle,inner sep=0.1em,rounded corners=5pt,very thick,dotted,draw=ugreen] [fit = (n11) (n12)] (b1) {};
\node [rectangle,inner sep=0.5em,rounded corners=5pt,very thick,dotted,draw=ugreen] [fit = (n10) (y1) (y5)] (b2) {};

\draw [->,dotted,very thick,ugreen] ([yshift=-0em]b1.east) .. controls +(east:1.7) and +(west:1) .. ([xshift=-0.1em]b2.west);
\node [anchor=east] (inputlabel1) at ([yshift=-0.2em]b1.west) {{\color{red} \footnotesize{人工标注数据}}};
        
\end{pgfonlayer}

\end{scope}

\begin{scope}[yshift=-2in]

\tikzstyle{rnnnode} = [draw,inner sep=2pt,minimum width=3em,minimum height=1.5em,rounded corners=1pt,fill=red!20]
\tikzstyle{snode} = [draw,inner sep=2pt,minimum width=3em,minimum height=1.5em,rounded corners=1pt,fill=blue!20]
\tikzstyle{ynode} = [inner sep=2pt,minimum width=3em,minimum height=1.5em,rounded corners=1pt]


\node [anchor=west,rnnnode] (n1) at (0,0) {$\mathbi{h}_{1}$};
\node [anchor=west] (n2) at ([xshift=2em,yshift=0em]n1.east) {$\cdots$};
\node [anchor=west,rnnnode] (n3) at ([xshift=2em,yshift=0em]n2.east) {$\mathbi{h}_{j-1}$};
\node [anchor=west,rnnnode] (n4) at ([xshift=2em,yshift=0em]n3.east) {$\mathbi{h}_{j}$};
\node [anchor=south,snode,font=\footnotesize] (n5) at ([xshift=0em,yshift=1em]n3.north) {Softmax};
\node [anchor=south,ynode] (n6) at ([xshift=0em,yshift=1em]n5.north) {$\tilde{{y}}_{j-1}$};
\node [anchor=south,snode,font=\footnotesize] (n7) at ([xshift=0em,yshift=1em]n4.north) {Softmax};
\node [anchor=south,ynode] (n8) at ([xshift=0em,yshift=1em]n7.north) {$\tilde{{y}}_{j}$};
\node [anchor=south,snode,font=\footnotesize] (n13) at ([xshift=0em,yshift=1em]n1.north) {Softmax};
\node [anchor=south,ynode] (n14) at ([xshift=0em,yshift=1em]n13.north) {$\tilde{{y}}_{1}$};

\node [anchor=north] (n9) at ([xshift=0em,yshift=-3em]n4.south) {\small{(b) 推断阶段}};

\node [anchor=north] (n11) at ([xshift=0em,yshift=-1em]n3.south) {$\tilde{{y}}_{j-2}$};
\node [anchor=north] (n12) at ([xshift=0em,yshift=-1em]n4.south) {$\tilde{{y}}_{j-1}$};

\node [anchor=north] (x1) at ([xshift=0em,yshift=-1em]n1.south) {$\langle$sos$\rangle$};

\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] (st3) at (n14.north) {\scriptsize{\textbf{[step $1$]}}};


\draw [->,thick] ([xshift=0em,yshift=0em]x1.north)--([xshift=0em,yshift=0em]n1.south);
\draw [->,thick] ([xshift=0em,yshift=0em]n1.east)--([xshift=0em,yshift=0em]n2.west);
\draw [->,thick] ([xshift=0em,yshift=0em]n2.east)--([xshift=0em,yshift=0em]n3.west);
\draw [->,thick] ([xshift=0em,yshift=0em]n3.east)--([xshift=0em,yshift=0em]n4.west);
\draw [->,thick] ([xshift=0em,yshift=0em]n4.east)--([xshift=2em,yshift=0em]n4.east);


\draw [->,thick] ([xshift=0em,yshift=0em]n3.north)--([xshift=0em,yshift=0em]n5.south);
\draw [->,thick] ([xshift=0em,yshift=0em]n5.north)--([xshift=0em,yshift=0em]n6.south);
\draw [->,thick] ([xshift=0em,yshift=0em]n4.north)--([xshift=0em,yshift=0em]n7.south);
\draw [->,thick] ([xshift=0em,yshift=0em]n7.north)--([xshift=0em,yshift=0em]n8.south);
\draw [->,thick] ([xshift=0em,yshift=0em]n1.north)--([xshift=0em,yshift=0em]n13.south);
\draw [->,thick] ([xshift=0em,yshift=0em]n13.north)--([xshift=0em,yshift=0em]n14.south);


\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]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] ([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);

\node [anchor=west] (n10) at ([xshift=4em,yshift=0em]n8.east) {模型输出$\tilde{{y}}$：};

\node [anchor=north west] (y1) at ([xshift=0.5em,yshift=-7em]n10.south west) {$\tilde{y}_{1}$};
\node [anchor=west] (y2) at ([xshift=1em,yshift=0em]y1.east) {$\tilde{y}_{2}$};
\node [anchor=west] (y3) at ([xshift=1em,yshift=0em]y2.east) {$\tilde{y}_{3}$};
\node [anchor=west] (y4) at ([xshift=0.5em,yshift=0em]y3.east) {$\ldots$};
\node [anchor=west] (y5) at ([xshift=0.5em,yshift=0em]y4.east) {$\tilde{y}_{n}$};


\node [anchor=center,prob,minimum size=0.2em] (label11) at ([xshift=-0.1em,yshift=1em]y1.north) {};
\node [anchor=center,prob,minimum size=0.9*1em] (label12) at ([xshift=0em,yshift=1.3em]label11.center) {.9};
\node [anchor=center,prob,minimum size=0.2em] (label13) at ([xshift=0em,yshift=1.3em]label12.center) {};
\node [anchor=center,prob,minimum size=0.2em] (label14) at ([xshift=0em,yshift=1.3em]label13.center) {};
\node [anchor=center,prob,minimum size=0.2em] (label15) at ([xshift=0em,yshift=1.3em]label14.center) {};
\begin{pgfonlayer}{background}
\node [anchor=center,minimum size=1em,white] (up1) at ([xshift=0em,yshift=0em]label11.center) {};
\node [anchor=center,minimum size=1em,white] (down1) at ([xshift=0em,yshift=0em]label15.center) {};
\node [inner sep=0.3em,draw] [fit = (up1) (down1)] (prob1) {};
\end{pgfonlayer}

\node [anchor=center,prob,minimum size=0.5*1em] (label21) at ([xshift=-0.1em,yshift=1em]y2.north) {.5};
\node [anchor=center,prob,minimum size=0.2em] (label22) at ([xshift=0em,yshift=1.3em]label21.center) {};
\node [anchor=center,prob,minimum size=0.7*1em] (label23) at ([xshift=0em,yshift=1.3em]label22.center) {.7};
\node [anchor=center,prob,minimum size=0.2em] (label24) at ([xshift=0em,yshift=1.3em]label23.center) {};
\node [anchor=center,prob,minimum size=0.9*1em] (label25) at ([xshift=0em,yshift=1.3em]label24.center) {.9};
\begin{pgfonlayer}{background}
\node [anchor=center,minimum size=1em,white] (up2) at ([xshift=0em,yshift=0em]label21.center) {};
\node [anchor=center,minimum size=1em,white] (down2) at ([xshift=0em,yshift=0em]label25.center) {};
\node [inner sep=0.3em,draw] [fit = (up2) (down2)] (prob2) {};
\end{pgfonlayer}

\node [anchor=center,prob,minimum size=0.2em] (label31) at ([xshift=-0.1em,yshift=1em]y3.north) {};
\node [anchor=center,prob,minimum size=0.9*1em] (label32) at ([xshift=0em,yshift=1.3em]label31.center) {.9};
\node [anchor=center,prob,minimum size=0.2em] (label33) at ([xshift=0em,yshift=1.3em]label32.center) {};
\node [anchor=center,prob,minimum size=0.5*1em] (label34) at ([xshift=0em,yshift=1.3em]label33.center) {.5};
\node [anchor=center,prob,minimum size=0.8*1em] (label35) at ([xshift=0em,yshift=1.3em]label34.center) {.8};
\begin{pgfonlayer}{background}
\node [anchor=center,minimum size=1em,white] (up3) at ([xshift=0em,yshift=0em]label31.center) {};
\node [anchor=center,minimum size=1em,white] (down3) at ([xshift=0em,yshift=0em]label35.center) {};
\node [inner sep=0.3em,draw] [fit = (up3) (down3)] (prob3) {};
\end{pgfonlayer}

\node [anchor=center,prob,minimum size=0.2em] (label41) at ([xshift=-0.1em,yshift=1em]y5.north) {};
\node [anchor=center,prob,minimum size=0.2em] (label42) at ([xshift=0em,yshift=1.3em]label41.center) {};
\node [anchor=center,prob,minimum size=0.2em] (label43) at ([xshift=0em,yshift=1.3em]label42.center) {};
\node [anchor=center,prob,minimum size=0.5*1em] (label44) at ([xshift=0em,yshift=1.3em]label43.center) {.5};
\node [anchor=center,prob,minimum size=0.2em] (label45) at ([xshift=0em,yshift=1.3em]label44.center) {};
\begin{pgfonlayer}{background}
\node [anchor=center,minimum size=1em,white] (up4) at ([xshift=0em,yshift=0em]label41.center) {};
\node [anchor=center,minimum size=1em,white] (down4) at ([xshift=0em,yshift=0em]label45.center) {};
\node [inner sep=0.3em,draw] [fit = (up4) (down4)] (prob4) {};
\end{pgfonlayer}


\begin{pgfonlayer}{background}

\node [rectangle,inner sep=0.1em,rounded corners=5pt,very thick,dotted,draw=ublue] [fit = (n11) (n12)] (b1) {};

\node [rectangle,inner sep=0.5em,rounded corners=5pt,very thick,dotted,draw=ublue] [fit = (n10) (y1) (y5)] (b2) {};

\draw [->,dotted,very thick,ublue] ([xshift=-0em,yshift=-0em]b1.east) .. controls +(east:1.7) and +(west:1) .. ([xshift=-0.1em]b2.west);
\node [anchor=east] (inputlabel1) at ([yshift=-0.2em]b1.west) {{\color{red} \footnotesize{系统预测结果}}};
        
\end{pgfonlayer}

\end{scope}


\end{tikzpicture}
