mirror of
https://github.com/MartinThoma/LaTeX-examples.git
synced 2025-04-19 11:38:05 +02:00
added 'perceptron-xor-task'
This commit is contained in:
parent
0ef1a9e285
commit
850fbc57a6
4 changed files with 77 additions and 0 deletions
35
tikz/perceptron-xor-task/Makefile
Normal file
35
tikz/perceptron-xor-task/Makefile
Normal file
|
@ -0,0 +1,35 @@
|
|||
SOURCE = perceptron-xor-task
|
||||
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/perceptron-xor-task/Readme.md
Normal file
3
tikz/perceptron-xor-task/Readme.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
Compiled example
|
||||
----------------
|
||||

|
BIN
tikz/perceptron-xor-task/perceptron-xor-task.png
Normal file
BIN
tikz/perceptron-xor-task/perceptron-xor-task.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
39
tikz/perceptron-xor-task/perceptron-xor-task.tex
Normal file
39
tikz/perceptron-xor-task/perceptron-xor-task.tex
Normal file
|
@ -0,0 +1,39 @@
|
|||
\documentclass{article}
|
||||
\usepackage[pdftex,active,tightpage]{preview}
|
||||
\setlength\PreviewBorder{2mm}
|
||||
|
||||
\usepackage{amsmath}
|
||||
\usepackage{tikz}
|
||||
\usetikzlibrary{shapes, calc, shapes, arrows}
|
||||
|
||||
\tikzstyle{input}=[draw,fill=red!50,circle,minimum size=20pt,inner sep=0pt]
|
||||
\tikzstyle{hidden}=[draw,fill=green!50,circle,minimum size=20pt,inner sep=0pt]
|
||||
\tikzstyle{output}=[draw,fill=blue!50,circle,minimum size=20pt,inner sep=0pt]
|
||||
\tikzstyle{bias}=[draw,dashed,fill=gray!50,circle,minimum size=20pt,inner sep=0pt]
|
||||
|
||||
\tikzstyle{stateTransition}=[->, thick]
|
||||
\DeclareMathOperator{\xor}{XOR}
|
||||
\begin{document}
|
||||
\begin{preview}
|
||||
\begin{tikzpicture}[scale=2]
|
||||
\node (x)[input] at (0,1) {$x$};
|
||||
\node (y)[input] at (0,0) {$y$};
|
||||
\node (h1)[hidden] at (1, 1.5) {$1$};
|
||||
\node (h2)[hidden] at (1, 0.5) {$2$};
|
||||
\node (h3)[hidden] at (1,-0.5) {$1$};
|
||||
\node (o1)[output] at (2,0.5) {};
|
||||
|
||||
\draw[stateTransition] (x) -- (h1) node [midway,above=-0.06cm] {$1$};
|
||||
\draw[stateTransition] (x) -- (h2) node [midway,above=-0.06cm] {$1$};
|
||||
\draw[stateTransition] (y) -- (h2) node [midway,above=-0.06cm] {$1$};
|
||||
\draw[stateTransition] (y) -- (h3) node [midway,above=-0.06cm] {$1$};
|
||||
|
||||
\draw[stateTransition] (h1) -- (o1) node [midway,above=-0.06cm] {$1$};
|
||||
\draw[stateTransition] (h2) -- (o1) node [midway,above=-0.1cm] {$-2$};
|
||||
\draw[stateTransition] (h3) -- (o1) node [midway,above=-0.06cm] {$1$};
|
||||
|
||||
\draw[stateTransition] (o1) -- (3.5,0.5) node [midway,above=-0.1cm] {$\xor(x, y)$};
|
||||
|
||||
\end{tikzpicture}
|
||||
\end{preview}
|
||||
\end{document}
|
Loading…
Add table
Add a link
Reference in a new issue