2d-epochs-overfitting.tex 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. \documentclass[varwidth=true, border=2pt]{standalone}
  2. \usepackage{pgfplots}
  3. \usepackage{tikz}
  4. \usetikzlibrary{positioning}
  5. \usetikzlibrary{decorations.text}
  6. \usetikzlibrary{decorations.pathmorphing}
  7. \begin{document}
  8. \begin{tikzpicture}
  9. \begin{axis}[
  10. legend pos=north east,
  11. axis x line=middle,
  12. axis y line=middle,
  13. grid = major,
  14. width=10cm,
  15. height=10cm,
  16. grid style={dashed, gray!30},
  17. xmin=0, % start the diagram at this x-coordinate
  18. xmax= 100, % end the diagram at this x-coordinate
  19. ymin=0, % start the diagram at this y-coordinate
  20. ymax= 0.98, % end the diagram at this y-coordinate
  21. axis background/.style={fill=white},
  22. xlabel=Epochs,
  23. ylabel=Error,
  24. tick align=outside,
  25. minor tick num=-3,
  26. enlargelimits=true,
  27. tension=0.08]
  28. \addplot[domain=2:50, red, thick,samples=200,dashed] {(x-50)^2/2700 + 0.1};
  29. \addplot[domain=4:50, green, thick,samples=200] {(x-50)^2/2700 + 0.2};
  30. \addplot[domain=50:100, red, thick,samples=200,dashed] {0.1};
  31. \addplot[domain=50:100, green, thick,samples=200] {(x-50)^2/10000 + 0.2};
  32. \draw[dashed] (axis cs:50,0.1) -- (axis cs:50,0.2);
  33. \draw[decoration={text along path, text={overfitting}, text align={center}}, decorate] (axis cs:51,0.15) -- (axis cs:90,0.15);
  34. \draw[->] (axis cs:51,0.15) -- (axis cs:90,0.15);
  35. \addlegendentry{Training}
  36. \addlegendentry{Testing}
  37. \end{axis}
  38. \end{tikzpicture}
  39. \end{document}