mirror of
https://github.com/MartinThoma/LaTeX-examples.git
synced 2025-04-19 11:38:05 +02:00
46 lines
1.7 KiB
TeX
46 lines
1.7 KiB
TeX
\documentclass{standalone}
|
|
|
|
\usepackage{pgfplots}
|
|
\usepackage{tikz}
|
|
\usetikzlibrary{positioning}
|
|
\usetikzlibrary{decorations.text}
|
|
\usetikzlibrary{decorations.pathmorphing}
|
|
\usetikzlibrary{arrows.meta}
|
|
|
|
\begin{document}
|
|
\begin{tikzpicture}
|
|
\tikzstyle{training}=[red, thick,samples=200,dashed]
|
|
\tikzstyle{testing}=[green, thick,samples=200]
|
|
\tikzstyle{arrow}=[<->, Latex-Latex, thick]
|
|
\begin{axis}[
|
|
legend pos=north east,
|
|
axis x line=middle,
|
|
axis y line=middle,
|
|
grid = major,
|
|
width=14cm,
|
|
height=8cm,
|
|
grid style={dashed, white}, % gray!30
|
|
xmin=0, % start the diagram at this x-coordinate
|
|
xmax= 104, % end the diagram at this x-coordinate
|
|
ymin= 0, % start the diagram at this y-coordinate
|
|
ymax= 0.79, % end the diagram at this y-coordinate
|
|
axis background/.style={fill=white},
|
|
xlabel=Training samples,
|
|
ylabel=Error,
|
|
tick align=outside,
|
|
minor tick num=-3,
|
|
tension=0.08]
|
|
\addplot[domain=1:100, testing] {1/(x+2)+0.4};
|
|
\addplot[domain=1:100, training] {0.4-(1/(x+2))};
|
|
|
|
% \draw[dashed,thick] (axis cs:0,0.4) -- (axis cs:110,0.4);
|
|
\draw[dashed,thick] (axis cs:0,0.2) -- (axis cs:110,0.2);
|
|
\path[arrow] (axis cs:80,0.2) edge node[right, midway] {avoidable bias} (axis cs:80,0.3878);
|
|
\path[arrow] (axis cs:20,0.3545) edge node[left, midway] {variance} (axis cs:20,0.4454);
|
|
\draw[decoration={text along path, text={human-level error}, text align={center}}, decorate] (axis cs:20,0.21) -- (axis cs:50,0.21);
|
|
|
|
\addlegendentry{Validation}
|
|
\addlegendentry{Training}
|
|
\end{axis}
|
|
\end{tikzpicture}
|
|
\end{document}
|