learn-curve-ml.tex 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. \documentclass{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=14cm,
  15. height=8cm,
  16. grid style={dashed, white}, % gray!30
  17. xmin=0, % start the diagram at this x-coordinate
  18. xmax= 104, % end the diagram at this x-coordinate
  19. ymin= 0, % start the diagram at this y-coordinate
  20. ymax= 0.79, % end the diagram at this y-coordinate
  21. axis background/.style={fill=white},
  22. xlabel=Training samples,
  23. ylabel=Error,
  24. tick align=outside,
  25. minor tick num=-3,
  26. tension=0.08]
  27. \addplot[domain=1:100, red, thick,samples=200,dashed] {1/(x+2)+0.4};
  28. \addplot[domain=1:100, green, thick,samples=200] {0.4-(1/(x+2))};
  29. % \draw[dashed,thick] (axis cs:0,0.4) -- (axis cs:110,0.4);
  30. \draw[dashed,thick] (axis cs:0,0.2) -- (axis cs:110,0.2);
  31. \draw[thick,<->] (axis cs:80,0.2) -- (axis cs:80,0.3878);
  32. \draw[thick,<->] (axis cs:20,0.3545) -- (axis cs:20,0.4454);
  33. \draw[decoration={text along path, text={desired}, text align={center}}, decorate] (axis cs:20,0.21) -- (axis cs:50,0.21);
  34. \draw[decoration={text along path, text={bias}, text align={center}}, decorate] (axis cs:80,0.28) -- (axis cs:90,0.28);
  35. \draw[decoration={text along path, text={variance}, text align={center}}, decorate] (axis cs:0,0.39) -- (axis cs:20,0.39);
  36. \addlegendentry{Validation}
  37. \addlegendentry{Training}
  38. \end{axis}
  39. \end{tikzpicture}
  40. \end{document}