mirror of
https://github.com/MartinThoma/LaTeX-examples.git
synced 2025-04-19 11:38:05 +02:00
Add SOM
This commit is contained in:
parent
23e30e1351
commit
268bb1422b
4 changed files with 109 additions and 0 deletions
35
tikz/self-organizing-map/Makefile
Normal file
35
tikz/self-organizing-map/Makefile
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
SOURCE = self-organizing-map
|
||||||
|
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/self-organizing-map/README.md
Normal file
3
tikz/self-organizing-map/README.md
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
Compiled example
|
||||||
|
----------------
|
||||||
|

|
BIN
tikz/self-organizing-map/self-organizing-map.png
Normal file
BIN
tikz/self-organizing-map/self-organizing-map.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 109 KiB |
71
tikz/self-organizing-map/self-organizing-map.tex
Normal file
71
tikz/self-organizing-map/self-organizing-map.tex
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
\documentclass[varwidth=true, border=2pt]{standalone}
|
||||||
|
\usepackage{tikz}
|
||||||
|
|
||||||
|
\tikzstyle{neuron}=[draw,circle,minimum size=12pt,inner sep=0pt, fill=white]
|
||||||
|
\tikzstyle{stateTransition}=[very thick]
|
||||||
|
\tikzstyle{learned}=[text=red]
|
||||||
|
\tikzstyle{input}=[draw,fill=red!50,circle,minimum size=10pt,inner sep=0pt]
|
||||||
|
|
||||||
|
\begin{document}
|
||||||
|
\newcommand\n{6}
|
||||||
|
\newcommand\xs{3}
|
||||||
|
\begin{tikzpicture}
|
||||||
|
\foreach \y in {1,...,\n}{
|
||||||
|
\foreach \x in {1,...,\n}{
|
||||||
|
\node (N-\y-\x)[neuron] at (0.55*\y + \x, 0.75*\y) {};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
\foreach \x in {1,...,\xs}{
|
||||||
|
\node (x-\x)[input] at (3+\x, -1) {$x_\x$};
|
||||||
|
}
|
||||||
|
|
||||||
|
\foreach \y in {1,...,\n}{
|
||||||
|
\foreach \x in {1,...,\n}{
|
||||||
|
\foreach \t in {1,...,\xs}{
|
||||||
|
\draw[thin, dashed, black!50] (x-\t) -- (N-\y-\x) node [midway,above=-0.06cm,sloped] {};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
\foreach \y in {1,...,\n}{
|
||||||
|
\foreach \x in {1,...,\n}{
|
||||||
|
\node (N-\y-\x)[neuron] at (0.55*\y + \x, 0.75*\y) {};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
% Make it look more like a board
|
||||||
|
\draw[very thick, dashed, black!50] (N-1-1) -- (N-1-2)
|
||||||
|
-- (N-1-3)
|
||||||
|
-- (N-1-4)
|
||||||
|
-- (N-1-5)
|
||||||
|
-- (N-1-6)
|
||||||
|
-- (N-2-6)
|
||||||
|
-- (N-3-6)
|
||||||
|
-- (N-4-6)
|
||||||
|
-- (N-5-6)
|
||||||
|
-- (N-6-6)
|
||||||
|
-- (N-6-5)
|
||||||
|
-- (N-6-4)
|
||||||
|
-- (N-6-3)
|
||||||
|
-- (N-6-2)
|
||||||
|
-- (N-6-1)
|
||||||
|
-- (N-5-1)
|
||||||
|
-- (N-4-1)
|
||||||
|
-- (N-3-1)
|
||||||
|
-- (N-2-1)
|
||||||
|
-- (N-1-1);
|
||||||
|
|
||||||
|
|
||||||
|
% Neighborhood gets excited
|
||||||
|
\node (N-4-3)[neuron, fill=black!50] at (0.55*4 + 3, 0.75*4) {};
|
||||||
|
\node (N-4-2)[neuron, fill=black!10] at (0.55*4 + 2, 0.75*4) {};
|
||||||
|
\node (N-4-4)[neuron, fill=black!10] at (0.55*4 + 4, 0.75*4) {};
|
||||||
|
\node (N-5-2)[neuron, fill=black!10] at (0.55*5 + 2, 0.75*5) {};
|
||||||
|
\node (N-5-3)[neuron, fill=black!10] at (0.55*5 + 3, 0.75*5) {};
|
||||||
|
\node (N-5-4)[neuron, fill=black!10] at (0.55*5 + 4, 0.75*5) {};
|
||||||
|
\node (N-3-3)[neuron, fill=black!10] at (0.55*3 + 2, 0.75*3) {};
|
||||||
|
\node (N-3-3)[neuron, fill=black!10] at (0.55*3 + 3, 0.75*3) {};
|
||||||
|
\node (N-3-3)[neuron, fill=black!10] at (0.55*3 + 4, 0.75*3) {};
|
||||||
|
\end{tikzpicture}
|
||||||
|
\end{document}
|
Loading…
Add table
Add a link
Reference in a new issue