Bias-variance decomposition: classic visualization of the fundamental tradeoff in statistical learning theory. From Sarmate's technical TikZ gallery (sources: MartinThoma/LaTeX-examples MIT, TeXample.net LPPL) — see also our 900+ figures on /tikz-gallery.php.
\documentclass[12pt,border=5pt]{standalone}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\usetikzlibrary{calc,angles,quotes,positioning,decorations.markings,arrows.meta,patterns,intersections,shapes,trees}
\usepackage{amsmath,amssymb}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
legend pos=north east,
axis x line=middle,
axis y line=middle,
width=8cm,
height=8cm,
%grid style={dashed, gray!30},
xmin= 0, % start the diagram at this x-coordinate
xmax= 2, % end the diagram at this x-coordinate
ymin= 0, % start the diagram at this y-coordinate
ymax= 2, % end the diagram at this y-coordinate
xlabel=error,
ylabel=model comlexity,
ticks=none,
xticklabels={,,},
yticklabels={,,},
x label style={at={(axis description cs:0.5,-0.05)},
anchor=north},
y label style={at={(axis description cs:-0.05,0.5)},
anchor=south,
rotate=90},]
% plot it
\addplot[domain=-0.29:2,samples=500,very thick] {1/(x+0.3)-0.2};
\addplot[domain=0:2, red, very thick,samples=500] {3*(x-2)*x+3.8};
\addlegendentry{training error}
\addlegendentry{validation}
\end{axis}
\end{tikzpicture}
\end{document}