2
0
Fork 0
mirror of https://github.com/MartinThoma/LaTeX-examples.git synced 2025-04-26 06:48:04 +02:00
LaTeX-examples/tikz/2d-epochs-overfitting/2d-epochs-overfitting.tex

45 lines
1.5 KiB
TeX
Raw Normal View History

2016-03-07 12:44:26 +01:00
\documentclass[varwidth=true, border=2pt]{standalone}
\usepackage{pgfplots}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{decorations.text}
\usetikzlibrary{decorations.pathmorphing}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
legend pos=north east,
axis x line=middle,
axis y line=middle,
grid = major,
2016-11-27 17:58:26 +01:00
width=10cm,
height=10cm,
2016-03-07 12:44:26 +01:00
grid style={dashed, gray!30},
2016-11-27 17:58:26 +01:00
xmin=0, % start the diagram at this x-coordinate
2016-03-07 12:44:26 +01:00
xmax= 100, % end the diagram at this x-coordinate
2016-11-27 17:58:26 +01:00
ymin=0, % start the diagram at this y-coordinate
2016-03-07 12:44:26 +01:00
ymax= 0.98, % end the diagram at this y-coordinate
axis background/.style={fill=white},
xlabel=Epochs,
ylabel=Error,
tick align=outside,
minor tick num=-3,
enlargelimits=true,
tension=0.08]
2016-11-27 17:58:26 +01:00
\addplot[domain=2:50, red, thick,samples=200,dashed] {(x-50)^2/2700 + 0.1};
2016-03-07 12:44:26 +01:00
\addplot[domain=4:50, green, thick,samples=200] {(x-50)^2/2700 + 0.2};
2016-11-27 17:58:26 +01:00
\addplot[domain=50:100, red, thick,samples=200,dashed] {0.1};
2016-03-07 12:44:26 +01:00
\addplot[domain=50:100, green, thick,samples=200] {(x-50)^2/10000 + 0.2};
\draw[dashed] (axis cs:50,0.1) -- (axis cs:50,0.2);
\draw[decoration={text along path, text={overfitting}, text align={center}}, decorate] (axis cs:51,0.15) -- (axis cs:90,0.15);
\draw[->] (axis cs:51,0.15) -- (axis cs:90,0.15);
\addlegendentry{Training}
\addlegendentry{Testing}
\end{axis}
\end{tikzpicture}
\end{document}