forked from MartinThoma/LaTeX-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2ce3442
commit cb58e0a
Showing
4 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
SOURCE = activation-functions | ||
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: | ||
#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-width=$(WIDTH) --export-plain-svg=$(SOURCE)1.svg | ||
rsvg-convert -a -w 720 -f svg $(SOURCE)1.svg -o $(SOURCE).svg | ||
rm $(SOURCE)1.svg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Compiled example | ||
---------------- | ||
![Example](activation-functions.png) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
\documentclass[varwidth=false, border=2pt]{standalone} | ||
|
||
\usepackage{pgfplots} | ||
\usepackage{tikz} | ||
\usepackage{xcolor} | ||
|
||
\begin{document} | ||
\begin{tikzpicture} | ||
\definecolor{color1}{HTML}{332288} | ||
\definecolor{color2}{HTML}{FDB863} | ||
\definecolor{color3}{HTML}{B2ABD2} | ||
\definecolor{color4}{HTML}{5E3C99} | ||
\begin{axis}[ | ||
legend pos=north west, | ||
legend cell align={left}, | ||
axis x line=middle, | ||
axis y line=middle, | ||
x tick label style={/pgf/number format/fixed, | ||
/pgf/number format/fixed zerofill, | ||
/pgf/number format/precision=1}, | ||
y tick label style={/pgf/number format/fixed, | ||
/pgf/number format/fixed zerofill, | ||
/pgf/number format/precision=1}, | ||
grid = major, | ||
width=16cm, | ||
height=8cm, | ||
grid style={dashed, gray!30}, | ||
xmin=-2, % start the diagram at this x-coordinate | ||
xmax= 2, % end the diagram at this x-coordinate | ||
ymin=-1, % start the diagram at this y-coordinate | ||
ymax= 2, % end the diagram at this y-coordinate | ||
%axis background/.style={fill=white}, | ||
xlabel=x, | ||
ylabel=y, | ||
tick align=outside, | ||
enlargelimits=false] | ||
% plot the stirling-formulae | ||
\addplot[domain=-2:2, color1, ultra thick,samples=500] {1/(1+exp(-x))}; | ||
\addplot[domain=-2:2, color2, ultra thick,samples=500] {tanh(x)}; | ||
\addplot[domain=-2:2, color4, ultra thick,samples=500] {max(0, x)}; | ||
\addplot[domain=-2:2, color4, ultra thick,samples=500, dashed] {ln(exp(x) + 1)}; | ||
\addplot[domain=-2:2, color3, ultra thick,samples=500, dotted] {max(x, exp(x) - 1)}; | ||
\addlegendentry{$\varphi_1(x)=\frac{1}{1+e^{-x}}$} | ||
\addlegendentry{$\varphi_2(x)=\tanh(x)$} | ||
\addlegendentry{$\varphi_3(x)=\max(0, x)$} | ||
\addlegendentry{$\varphi_4(x)=\log(e^x + 1)$} | ||
\addlegendentry{$\varphi_5(x)=\max(x, e^x - 1)$} | ||
\end{axis} | ||
\end{tikzpicture} | ||
\end{document} |