Skip to content

Instantly share code, notes, and snippets.

@michaeldorner
Created June 1, 2023 07:20
Show Gist options
  • Save michaeldorner/67b50414c2242dba32105d118531a2f1 to your computer and use it in GitHub Desktop.
Save michaeldorner/67b50414c2242dba32105d118531a2f1 to your computer and use it in GitHub Desktop.
\documentclass[margin=1cm]{standalone}
\usepackage{tikz}
\definecolor{ACMYellow}{RGB}{255, 214, 0}
\definecolor{ACMOrange}{RGB}{252, 146, 0}
\definecolor{ACMRed}{RGB}{253, 27, 20}
\definecolor{ACMLightBlue}{RGB}{131, 206, 226}
\definecolor{ACMGreen}{RGB}{166, 188, 9}
\definecolor{ACMPurple}{RGB}{101, 1, 107}
\definecolor{ACMDarkBlue}{RGB}{9, 53, 122}
\begin{document}
\begin{tikzpicture}[scale=2, domain=-2:2, y=0.5cm]
\draw[->, thick] (-2.25,-0.25) -- (2.25,-0.25) node [below] {Model complexity};
\draw[->, thick] (-2.25,-0.25) -- (-2.25,5) node [midway, left] {Model error};
\draw[dashed, thick] (0,-0.25) node [below, text width=3cm, align=center] {Optimal model complexity} -- (0,5) ;
\draw[->, thick] (-0.5,4) -- (-1.5,4) node [midway, above] {Underfitting};
\draw[->, thick] (0.5,4) -- (1.5,4)node [midway, above] {Overfitting};
\coordinate (O) at (0,0);
\draw[ACMRed, thick] plot[samples=100] (\x, {2^\x + 2^(-\x)}) node[above right] {Overall model error};
\draw[ACMPurple, thick] plot[samples=100] (\x, {2^(\x)}) node[right] {Modelled noise (variance)};
\draw[ACMOrange, thick] plot[samples=100] (\x, {2^(-\x)}) node[right] {Unmodelled information (bias)};
\node[text width=12cm, anchor=north, yshift=-2cm] {\textbf{Caption:} Model error resulting from the superposition of two error curves: (i) the bias error which results from too simple models and can be mitigated by increasing the model complexity and (ii) the variance error which reduces the uncertainty with growing model complexity. };
\end{tikzpicture}
\end{document}
@michaeldorner
Copy link
Author

simulation_model_complexity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment