mirror of
https://github.com/MartinThoma/LaTeX-examples.git
synced 2025-04-19 11:38:05 +02:00
Add graph for epochs / error curve
This commit is contained in:
parent
5701875ff9
commit
c2e2ba7769
4 changed files with 82 additions and 0 deletions
BIN
tikz/2d-epochs-overfitting/2d-epochs-overfitting.png
Normal file
BIN
tikz/2d-epochs-overfitting/2d-epochs-overfitting.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 38 KiB |
46
tikz/2d-epochs-overfitting/2d-epochs-overfitting.tex
Normal file
46
tikz/2d-epochs-overfitting/2d-epochs-overfitting.tex
Normal file
|
@ -0,0 +1,46 @@
|
|||
\documentclass[varwidth=true, border=2pt]{standalone}
|
||||
|
||||
\usepackage{pgfplots}
|
||||
\usepackage{tikz}
|
||||
\usetikzlibrary{positioning}
|
||||
\usetikzlibrary{decorations.text}
|
||||
\usetikzlibrary{decorations.pathmorphing}
|
||||
|
||||
\begin{document}
|
||||
\begin{tikzpicture}
|
||||
\begin{axis}[
|
||||
legend pos=north east,
|
||||
axis x line=middle,
|
||||
axis y line=middle,
|
||||
grid = major,
|
||||
%width=9cm,
|
||||
%height=4.5cm,
|
||||
grid style={dashed, gray!30},
|
||||
xmin=-1, % start the diagram at this x-coordinate
|
||||
xmax= 100, % end the diagram at this x-coordinate
|
||||
ymin=-0.01, % start the diagram at this y-coordinate
|
||||
ymax= 0.98, % end the diagram at this y-coordinate
|
||||
axis background/.style={fill=white},
|
||||
xlabel=Epochs,
|
||||
ylabel=Error,
|
||||
%xticklabels={-2,-1.6,...,7},
|
||||
%yticklabels={-8,-7,...,8},
|
||||
tick align=outside,
|
||||
minor tick num=-3,
|
||||
enlargelimits=true,
|
||||
tension=0.08]
|
||||
\addplot[domain=2:50, red, thick,samples=200] {(x-50)^2/2700 + 0.1};
|
||||
\addplot[domain=4:50, green, thick,samples=200] {(x-50)^2/2700 + 0.2};
|
||||
|
||||
\addplot[domain=50:100, red, thick,samples=200] {0.1};
|
||||
\addplot[domain=50:100, green, thick,samples=200] {(x-50)^2/10000 + 0.2};
|
||||
|
||||
\draw[dashed] (axis cs:50,0.1) -- (axis cs:50,0.2);
|
||||
\draw[decoration={text along path, text={overfitting}, text align={center}}, decorate] (axis cs:51,0.15) -- (axis cs:90,0.15);
|
||||
\draw[->] (axis cs:51,0.15) -- (axis cs:90,0.15);
|
||||
|
||||
\addlegendentry{Training}
|
||||
\addlegendentry{Testing}
|
||||
\end{axis}
|
||||
\end{tikzpicture}
|
||||
\end{document}
|
33
tikz/2d-epochs-overfitting/Makefile
Normal file
33
tikz/2d-epochs-overfitting/Makefile
Normal file
|
@ -0,0 +1,33 @@
|
|||
SOURCE = 2d-epochs-overfitting
|
||||
DELAY = 80
|
||||
DENSITY = 300
|
||||
WIDTH = 512
|
||||
|
||||
make:
|
||||
pdflatex $(SOURCE).tex -output-format=pdf
|
||||
make clean
|
||||
|
||||
clean:
|
||||
rm -rf $(TARGET) *.class *.html *.log *.aux *.data *.gnuplot
|
||||
|
||||
gif:
|
||||
pdfcrop $(SOURCE).pdf
|
||||
convert -verbose -delay $(DELAY) -loop 0 -density $(DENSITY) $(SOURCE)-crop.pdf $(SOURCE).gif
|
||||
make clean
|
||||
|
||||
png:
|
||||
make
|
||||
make svg
|
||||
inkscape $(SOURCE).svg -w $(WIDTH) --export-png=$(SOURCE).png
|
||||
|
||||
transparentGif:
|
||||
convert $(SOURCE).pdf -transparent white result.gif
|
||||
make clean
|
||||
|
||||
svg:
|
||||
#inkscape $(SOURCE).pdf --export-plain-svg=$(SOURCE).svg
|
||||
pdf2svg $(SOURCE).pdf $(SOURCE).svg
|
||||
# Necessary, as pdf2svg does not always create valid svgs:
|
||||
inkscape $(SOURCE).svg --export-width=$(WIDTH) --export-plain-svg=$(SOURCE)1.svg
|
||||
rsvg-convert -a -w 720 -f svg $(SOURCE)1.svg -o $(SOURCE).svg
|
||||
rm $(SOURCE)1.svg
|
3
tikz/2d-epochs-overfitting/README.md
Normal file
3
tikz/2d-epochs-overfitting/README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
Compiled example
|
||||
----------------
|
||||

|
Loading…
Add table
Add a link
Reference in a new issue