overfitting.tex 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. \definecolor{c1}{HTML}{0072B2}
  2. \definecolor{c2}{HTML}{009E73}
  3. \begin{tikzpicture}
  4. \tikzstyle{training}=[c1, thick,samples=200,dashed]
  5. \tikzstyle{testing}=[c2, thick,samples=200]
  6. \begin{axis}[
  7. legend pos=north east,
  8. legend cell align=left,
  9. axis x line=middle,
  10. axis y line=middle,
  11. grid = major,
  12. width=14cm,
  13. height=8cm,
  14. grid style={dashed, gray!30},
  15. xmin=0, % start the diagram at this x-coordinate
  16. xmax= 104, % end the diagram at this x-coordinate
  17. ymin=0, % start the diagram at this y-coordinate
  18. ymax= 0.98, % end the diagram at this y-coordinate
  19. axis background/.style={fill=white},
  20. xlabel=Epochs,
  21. ylabel=Error,
  22. y label style={at={(-0.1,1.0)}},
  23. tick align=outside,
  24. minor tick num=-3,
  25. tension=0.08]
  26. \addplot[domain=2:50, training] {(x-50)^2/2700 + 0.1};
  27. \addplot[domain=4:50, testing] {(x-50)^2/2700 + 0.2};
  28. \addplot[domain=50:100, training] {0.1};
  29. \addplot[domain=50:100, testing] {(x-50)^2/10000 + 0.2};
  30. \draw[dashed, very thick] (axis cs:50,0.0) -- (axis cs:50,0.3);
  31. \draw[decoration={text along path, text={overfitting}, text align={center}}, decorate] (axis cs:51,0.16) -- (axis cs:90,0.16);
  32. \draw[-{latex[scale=3.0]}, very thick] (axis cs:51,0.15) -- (axis cs:90,0.15);
  33. \addlegendentry{Training set}
  34. \addlegendentry{Validation set}
  35. \end{axis}
  36. \end{tikzpicture}