mirror of
https://github.com/MartinThoma/LaTeX-examples.git
synced 2025-04-26 06:48:04 +02:00
Add neural networks
This commit is contained in:
parent
2d49f93b4d
commit
23e30e1351
8 changed files with 163 additions and 0 deletions
35
tikz/hopfield-network/Makefile
Normal file
35
tikz/hopfield-network/Makefile
Normal file
|
@ -0,0 +1,35 @@
|
|||
SOURCE = hopfield-network
|
||||
DELAY = 80
|
||||
DENSITY = 300
|
||||
WIDTH = 512
|
||||
|
||||
make:
|
||||
pdflatex $(SOURCE).tex -output-format=pdf
|
||||
make clean
|
||||
|
||||
clean:
|
||||
rm -rf $(TARGET) *.class *.html *.log *.aux *.data *.gnuplot
|
||||
|
||||
gif:
|
||||
pdfcrop $(SOURCE).pdf
|
||||
convert -verbose -delay $(DELAY) -loop 0 -density $(DENSITY) $(SOURCE)-crop.pdf $(SOURCE).gif
|
||||
make clean
|
||||
|
||||
png:
|
||||
make
|
||||
make svg
|
||||
inkscape $(SOURCE).svg -w $(WIDTH) --export-png=$(SOURCE).png
|
||||
|
||||
transparentGif:
|
||||
convert $(SOURCE).pdf -transparent white result.gif
|
||||
make clean
|
||||
|
||||
svg:
|
||||
make
|
||||
#inkscape $(SOURCE).pdf --export-plain-svg=$(SOURCE).svg
|
||||
pdf2svg $(SOURCE).pdf $(SOURCE).svg
|
||||
# Necessary, as pdf2svg does not always create valid svgs:
|
||||
inkscape $(SOURCE).svg --export-plain-svg=$(SOURCE).svg
|
||||
rsvg-convert -a -w $(WIDTH) -f svg $(SOURCE).svg -o $(SOURCE)2.svg
|
||||
inkscape $(SOURCE)2.svg --export-plain-svg=$(SOURCE).svg
|
||||
rm $(SOURCE)2.svg
|
3
tikz/hopfield-network/README.md
Normal file
3
tikz/hopfield-network/README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
Compiled example
|
||||
----------------
|
||||

|
BIN
tikz/hopfield-network/hopfield-network.png
Normal file
BIN
tikz/hopfield-network/hopfield-network.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 36 KiB |
28
tikz/hopfield-network/hopfield-network.tex
Normal file
28
tikz/hopfield-network/hopfield-network.tex
Normal file
|
@ -0,0 +1,28 @@
|
|||
\documentclass[varwidth=true, border=2pt]{standalone}
|
||||
\usepackage{tikz}
|
||||
|
||||
\tikzstyle{neuron}=[draw,circle,minimum size=20pt,inner sep=0pt, fill=white]
|
||||
\tikzstyle{stateTransition}=[very thick]
|
||||
\tikzstyle{learned}=[text=red]
|
||||
|
||||
\begin{document}
|
||||
\newcommand\n{5}
|
||||
\begin{tikzpicture}[scale=1.3]
|
||||
\begin{scope}[rotate=17]
|
||||
%the multiplication with floats is not possible. Thus I split the loop in two.
|
||||
\foreach \number in {1,...,\n}{
|
||||
\node[neuron] (N-\number) at ({\number*(360/\n)}:1.5cm) {$x_\number$};
|
||||
}
|
||||
|
||||
\foreach \number in {1,...,\n}{
|
||||
\foreach \y in {1,...,\n}{
|
||||
\draw[stateTransition] (N-\number) -- (N-\y);
|
||||
}
|
||||
}
|
||||
\end{scope}
|
||||
\begin{scope}[rotate=-1]
|
||||
\draw[learned,stateTransition] (N-1) -- (N-2) node [midway,above=-0.15cm,sloped] {$w_{1,2}$};
|
||||
\draw[learned,stateTransition] (N-1) -- (N-5) node [midway,above=-0.15cm,sloped] {$w_{1,5}$};
|
||||
\end{scope}
|
||||
\end{tikzpicture}
|
||||
\end{document}
|
Loading…
Add table
Add a link
Reference in a new issue