2
0
Fork 0
mirror of https://github.com/MartinThoma/LaTeX-examples.git synced 2025-04-19 11:38:05 +02:00
LaTeX-examples/documents/handout-art-in-ml/activation-functions.tikz
2016-03-07 12:43:10 +01:00

27 lines
No EOL
1.1 KiB
Text

\begin{tikzpicture}[scale=1.0]
\begin{axis}[
legend pos=north west,
axis x line=middle,
axis y line=middle,
grid = major,
width=16cm,
height=4cm,
grid style={dashed, gray!30},
xmin=-5, % start the diagram at this x-coordinate
xmax= 5, % end the diagram at this x-coordinate
ymin=-1, % start the diagram at this y-coordinate
ymax= 1, % end the diagram at this y-coordinate
%axis background/.style={fill=white},
xlabel=$x$,
ylabel=$y$,
tick align=outside,
enlargelimits=true]
\addplot[green!50!black, ultra thick] coordinates {(-5,-1) (0,-1) (0, 1) (5, 1)};
% \addplot[domain=-5:5, green!50!black, ultra thick,samples=500] {x < 0 ? -1 : 1};
\addplot[domain=-5:5, red, ultra thick,samples=500, dash pattern=on 8pt off 2pt] {1/(1+exp(-x))};
\addplot[domain=-5:5, blue, ultra thick,samples=500, dotted] {tanh(x)};
\addlegendentry{sign function}
\addlegendentry{$\sigmoid$}
\addlegendentry{$\tanh$}
\end{axis}
\end{tikzpicture}