%%%------------------------------------------------------------------------------------------------------------ \begin{tikzpicture} \begin{scope}[] \def\neuronsep{1.5} \tikzstyle{neuronnode} = [minimum size=2em,circle,draw,ublue,very thick,inner sep=1pt, fill=white,align=center,drop shadow={shadow xshift=0.1em,shadow yshift=-0.1em}] %%% layer 1 \foreach \n in {1,...,5}{ \node [neuronnode] (neuron0\n) at (\n * \neuronsep,0) {\tiny{$f_1$}\\[-1ex] \tiny{$\sum$}}; \draw [-,ublue] (neuron0\n.east) -- (neuron0\n.west); } \foreach \n in {1,...,5}{ \foreach \m in {1,...,5}{ \draw [<-] ([yshift=-0.1em]neuron0\m.south) -- ([yshift=-1.8em]neuron0\n.south); } \node [anchor=north] (x\n) at ([yshift=-2em]neuron0\n.south) {$x_\n$}; } \node [anchor=west] (w1label) at ([xshift=-0.5em,yshift=0.8em]x5.north east) {${\mathbi{W}}^{[1]}$}; \begin{pgfonlayer}{background} \node [rectangle,inner sep=0.2em,fill=red!20] [fit = (neuron01) (neuron05)] (layer01) {}; \end{pgfonlayer} \node [anchor=west] (layer00label) at ([xshift=1.4em]x5.east) {\footnotesize{第0层}}; \node [anchor=west] (layer00label2) at (layer00label.east) {\footnotesize{(输入层)}}; { \node [anchor=west] (layer01label) at ([xshift=1em]layer01.east) {\footnotesize{第1层}}; } { \node [anchor=west] (layer01label2) at (layer01label.east) {\footnotesize{({隐层})}}; } %%% layer 2 { \foreach \n in {2,...,4}{ \node [neuronnode] (neuron1\n) at (\n * \neuronsep,4.5em) {\tiny{$f_2$}\\[-1ex] \tiny{$\sum$}}; \draw [-,ublue] (neuron1\n.east) -- (neuron1\n.west); } \foreach \n in {2,...,4}{ \foreach \m in {1,...,5}{ \draw [<-] ([yshift=-0.1em]neuron1\n.south) -- (neuron0\m.north); } } \node [anchor=west] (w2label) at ([xshift=-2.5em,yshift=5.4em]x5.north east) {${\mathbi{W}}^{[2]}$}; \begin{pgfonlayer}{background} { \node [rectangle,inner sep=0.2em,fill=ugreen!20] [fit = (neuron12) (neuron14)] (layer02) {}; } \end{pgfonlayer} \node [anchor=west] (layer02label) at ([xshift=5em]layer02.east) {\footnotesize{第2层}}; { \node [anchor=west] (layer02label2) at (layer02label.east) {\footnotesize{({隐层})}}; } } %%% layer 3 { \foreach \n in {1,...,5}{ \node [neuronnode] (neuron2\n) at (\n * \neuronsep,9em) {\tiny{$f_3$}\\[-1ex] \tiny{$\sum$}}; \draw [-,ublue] (neuron2\n.east) -- (neuron2\n.west); } \foreach \n in {1,...,5}{ \foreach \m in {2,...,4}{ \draw [<-] ([yshift=-0.1em]neuron2\n.south) -- (neuron1\m.north); } \node [anchor=south] (y\n) at ([yshift=1.2em]neuron2\n.north) {$y_\n$}; \draw [<-,thick] ([yshift=1.1em]neuron2\n.north) -- (neuron2\n.north); } \node [anchor=west] (w3label) at ([xshift=-2.5em,yshift=9.5em]x5.north east) {${\mathbi{W}}^{[3]}$}; \begin{pgfonlayer}{background} { \node [rectangle,inner sep=0.2em,fill=blue!20] [fit = (neuron21) (neuron25)] (layer03) {}; } \end{pgfonlayer} \node [anchor=west] (layer03label) at ([xshift=1em]layer03.east) {\footnotesize{第3层}}; { \node [anchor=west] (layer03label2) at (layer03label.east) {\footnotesize{({输出层})}}; } } \end{scope} \end{tikzpicture} %%%------------------------------------------------------------------------------------------------------------