1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
\begin{frame}
\frametitle{Neural Network}
\centering
\newcommand{\inputnum}{4}
% Hidden layer neurons'number
\newcommand{\hiddennumA}{5}
\newcommand{\hiddennumB}{6}
% Output layer neurons'number
\newcommand{\outputnum}{4}
\begin{tikzpicture}
% Input Layer
\foreach \i in {1,...,\inputnum}
{
\node[circle,
minimum size = 6mm,
fill=blue!30] (Input-\i) at (0,-\i) {};
}
% Hidden Layer1
\foreach \i in {1,...,\hiddennumA}
{
\node[circle,
minimum size = 6mm,
fill=red!50,
yshift=(\hiddennumA-\inputnum)*5 mm
] (Hidden1-\i) at (2.5,-\i) {};
}
% Hidden Layer2
\foreach \i in {1,...,\hiddennumB}
{
\node[circle,
minimum size = 6mm,
fill=red!50,
yshift=(\hiddennumB-\inputnum)*5 mm
] (Hidden2-\i) at (5,-\i) {};
}
% Output Layer
\foreach \i in {1,...,\outputnum}
{
\node[circle,
minimum size = 6mm,
fill=green!50,
yshift=(\outputnum-\inputnum)*5 mm
] (Output-\i) at (7.5,-\i) {};
}
% Connect neurons In-Hidden
\foreach \i in {1,...,\inputnum}
{
\foreach \j in {1,...,\hiddennumA}
{
\draw[->, shorten >=1pt] (Input-\i) -- (Hidden1-\j);
}
}
% Connect neurons In-Hidden
\foreach \i in {1,...,\hiddennumA}
{
\foreach \j in {1,...,\hiddennumB}
{
\draw[->, shorten >=1pt] (Hidden1-\i) -- (Hidden2-\j);
}
}
% Connect neurons Hidden-Out
\foreach \i in {1,...,\hiddennumB}
{
\foreach \j in {1,...,\outputnum}
{
\draw[->, shorten >=1pt] (Hidden2-\i) -- (Output-\j);
}
}
% Inputs
\foreach \i in {1,...,\inputnum}
{
\draw[<-, shorten <=1pt] (Input-\i) -- ++(-1,0)
node[left]{\LARGE{$x_{\i}$}};
}
% Outputs
\foreach \i in {1,...,\outputnum}
{
\draw[->, shorten <=1pt] (Output-\i) -- ++(1,0)
node[right]{\LARGE{$y_{\i}$}};
}
\end{tikzpicture}
\end{frame}
|