-
Notifications
You must be signed in to change notification settings - Fork 3
/
nn-auto_net_icon+neuralnet+style+foreach+set+function+learn.tex
66 lines (53 loc) · 1.94 KB
/
nn-auto_net_icon+neuralnet+style+foreach+set+function+learn.tex
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
% https://tex.stackexchange.com/questions/446948/how-to-place-a-parabola-distribution-on-top-of-a-node-in-tikz?rq=1
\documentclass[tikz,margin=2mm]{standalone}
\usepackage{tikz}
\tikzset{
declare function={
sig = 0.1;
mu = 0;
g(\x) = 1/(sig*sqrt(2*pi)) * exp(-1/2 * ((\x-mu)/sig)^2);
}
}
\begin{document}
\begin{tikzpicture}[
shorten >=1pt,
->,
draw=black!50,
node distance=2.5cm,
scale=1.5,
every pin edge/.style={<-,shorten <=1pt},
neuron/.style={
circle,fill=black!25,minimum size=17pt,inner sep=0pt,
path picture={
\draw[red,thick,-] plot[domain=-0.3:0.3,samples=11,smooth] ({\x},{0.05*g(\x)});
},
},
input neuron/.style={neuron, fill=green!50},
output neuron/.style={neuron, fill=red!50},
hidden neuron/.style={neuron, fill=blue!50},
annot/.style={text width=4em, text centered},
]
% Draw the input layer nodes
\foreach \name / \y in {1,...,4}
% This is the same as writing \foreach \name / \y in {1/1,2/2,3/3,4/4}
\node[input neuron, pin=left:Input \y] (I-\name) at (0,-\y) {};
% Draw the hidden layer nodes
\foreach \name / \y in {1,...,5}
\path[yshift=0.5cm]
node[hidden neuron] (H-\name) at (2.5cm,-\y cm) {};
% Draw the output layer node
\node[output neuron,pin={[pin edge={->}]right:Output}, right of=H-3] (O) {};
% Connect every node in the input layer with every node in the
% hidden layer.
\foreach \source in {1,...,4}
\foreach \dest in {1,...,5}
\path (I-\source) edge (H-\dest);
% Connect every node in the hidden layer with the output layer
\foreach \source in {1,...,5}
\path (H-\source) edge (O);
% Annotate the layers
\node[annot,above of=H-1, node distance=1cm] (hl) {Hidden layer};
\node[annot,above of=I-1, node distance=1cm] {Input layer};
\node[annot,above of=O] {Output layer};
\end{tikzpicture}
\end{document}