Neural Network color
Author
Chih-Hsiang Chang
Last Updated
10 лет назад
License
Creative Commons CC BY 4.0
Abstract
Neural Network with different color
\documentclass[border=0.125cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\tikzset{%
neuron missing/.style={
draw=none,
scale=4,
text height=0.333cm,
execute at begin node=\color{black}$\vdots$
},
}
\begin{tikzpicture}[x=1.5cm, y=1.5cm, >=stealth]
\foreach \m/\l [count=\y] in {1,2,3}
{
\node [circle,fill=green!50,minimum size=1cm] (input-\m) at (0,2.5-\y) {};
}
\foreach \m/\l [count=\y] in {4}
{
\node [circle,fill=green!50,minimum size=1cm ] (input-\m) at (0,-2.5) {};
}
\node [neuron missing] at (0,-1.5) {};
\foreach \m [count=\y] in {1}
\node [circle,fill=red!50,minimum size=1cm ] (hidden-\m) at (2,0.75) {};
\foreach \m [count=\y] in {2}
\node [circle,fill=red!50,minimum size=1cm ] (hidden-\m) at (2,-1.85) {};
\node [neuron missing] at (2,-0.3) {};
\foreach \m [count=\y] in {1}
\node [circle,fill=blue!50,minimum size=1cm ] (output-\m) at (4,1.5-\y) {};
\foreach \m [count=\y] in {2}
\node [circle,fill=blue!50,minimum size=1cm ] (output-\m) at (4,-0.5-\y) {};
\node [neuron missing] at (4,-0.4) {};
\foreach \l [count=\i] in {1,2,3,256}
\draw [<-] (input-\i) -- ++(-1,0)
node [above, midway] {$I_{\l}$};
\foreach \l [count=\i] in {1,16}
\node [above] at (hidden-\i.north) {$H_{\l}$};
\foreach \l [count=\i] in {1,16}
\draw [->] (output-\i) -- ++(1,0)
node [above, midway] {$O_{ \l}$};
\foreach \i in {1,...,4}
\foreach \j in {1,...,2}
\draw [->] (input-\i) -- (hidden-\j);
\foreach \i in {1,...,2}
\foreach \j in {1,...,2}
\draw [->] (hidden-\i) -- (output-\j);
%\foreach \l [count=\x from 0] in {Input, Hidden, Ouput}
% \node [align=center, above] at (\x*2,2) {\l \\ layer};
\end{tikzpicture}
\end{document}