From: Nathan TeBlunthuis Date: Fri, 2 Sep 2022 00:52:25 +0000 (-0700) Subject: refactor example charts X-Git-Url: https://code.communitydata.science/ml_measurement_error_public.git/commitdiff_plain/b04f18afb78519c154a02048a6e8a1883cae6702?hp=--cc refactor example charts --- b04f18afb78519c154a02048a6e8a1883cae6702 diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..f2d69ab --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "paper"] + path = paper + url = git@github.com:chainsawriot/measure.git diff --git a/charts/.gitignore b/charts/.gitignore new file mode 100644 index 0000000..76c74db --- /dev/null +++ b/charts/.gitignore @@ -0,0 +1,9 @@ +*.aux +*.svg +*.pdf +*.png +*.aux +*.fdb_latexmk +*.log +*.fls +auto/* diff --git a/charts/example_3_dag/Makefile b/charts/Makefile similarity index 81% rename from charts/example_3_dag/Makefile rename to charts/Makefile index 4bcb5ad..4288d05 100644 --- a/charts/example_3_dag/Makefile +++ b/charts/Makefile @@ -6,8 +6,7 @@ all: $(patsubst %.tex,%.svg,$(wildcard *.tex)) $(patsubst %.tex,%.png,$(wildcard convert -density 300 -transparent white $< $@ %.svg: %.pdf - /usr/bin/inkscape $< --export-plain-svg=$@ - + /usr/bin/inkscape $< --export-plain-svg --export-type=svg --export-filename=$@ %.pdf: %.tex latexmk -f -pdf $< @@ -18,6 +17,7 @@ clean: rm -f vc rm *.svg + viewpdf: all evince *.pdf diff --git a/charts/example_1_dag.tex b/charts/example_1_dag.tex new file mode 100644 index 0000000..6ef0e4a --- /dev/null +++ b/charts/example_1_dag.tex @@ -0,0 +1,46 @@ +\documentclass[12pt]{standalone} + +\usepackage{ucs} +\usepackage[utf8x]{inputenc} + +\usepackage[T1]{fontenc} +\usepackage{textcomp} +\renewcommand{\rmdefault}{ugm} +\renewcommand{\sfdefault}{phv} +\usepackage[garamond]{mathdesign} +\usepackage{tikz} +\usetikzlibrary{positioning, shapes, arrows, shadows, } + +\begin{document} +\tikzset{ + observed/.style={circle, draw}, + partly observed/.style 2 args={draw, fill=#2, path picture={ + \fill[#1, sharp corners] (path picture bounding box.south west) -| + (path picture bounding box.north east) -- cycle;}, + circle}, + unobserved/.style={draw, circle, fill=gray!40}, + residual/.style={draw, rectangle} +} + +\tikzset{>=latex} +\begin{tikzpicture} + + \node[observed] (y) {$Y$}; + \node[unobserved, above=of y] (x) {$X$}; + \node[observed, left=of x] (w) {$W$}; + +% \node[unobserved, above=of w] (k) {$K$}; + \node[observed,right=of x] (z) {$Z$}; +% \node[residual,below=of y] (e) {$\varepsilon$}; +% \node[residual,below=of w] (xi) {$\xi$}; + + \draw[->] (z) to (y); + \draw[->] (z) -- (x); + \draw[->] (x) -- (y); + \draw[->] (x) -- (w); +% \draw[->] (y) -- (w); +% \draw[->] (x) -- (xi); + % \draw[->] (w) -- (xi); +\end{tikzpicture} +\end{document} + diff --git a/charts/example_1_dag/.gitignore b/charts/example_1_dag/.gitignore deleted file mode 100644 index 69e1873..0000000 --- a/charts/example_1_dag/.gitignore +++ /dev/null @@ -1,12 +0,0 @@ -/auto/ -/vc -/refs-processed.bib -/*.aux -/*.bbl -/*.blg -/*.log -/*.out -/*.pdf -/*.fdb_latexmk -/*.fls -/*.ttt diff --git a/charts/example_1_dag/Makefile b/charts/example_1_dag/Makefile deleted file mode 100644 index 75fef1f..0000000 --- a/charts/example_1_dag/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/make - -all: $(patsubst %.tex,%.svg,$(wildcard *.tex)) $(patsubst %.tex,%.png,$(wildcard *.tex)) - -%.png: %.pdf - convert -density 300 -transparent white $< $@ - -%.svg: %.pdf - /usr/bin/inkscape $< --export-plain-svg=$@ - -%.pdf: %.tex - latexmk -f -pdf $< - -clean: - latexmk -C *.tex - rm -f *.tmp - rm -f vc - rm *.svg - -viewpdf: all - evince *.pdf - -vc: - vc-git - -pdf: all - -.PHONY: clean all diff --git a/charts/example_1_dag/example_1_dag.tex b/charts/example_1_dag/example_1_dag.tex deleted file mode 100644 index ec6cc78..0000000 --- a/charts/example_1_dag/example_1_dag.tex +++ /dev/null @@ -1,46 +0,0 @@ -\documentclass[12pt]{standalone} - -\usepackage{ucs} -\usepackage[utf8x]{inputenc} - -\usepackage[T1]{fontenc} -\usepackage{textcomp} -\renewcommand{\rmdefault}{ugm} -\renewcommand{\sfdefault}{phv} -\usepackage[garamond]{mathdesign} -\usepackage{tikz} -\usetikzlibrary{positioning, shapes, arrows, shadows, } - -\begin{document} - -\tikzset{>=latex} -\begin{tikzpicture}[ - observed/.style={circle, draw}, - unobserved/.style={draw, circle, fill=gray!40}, - legend/.style={rectangle, draw}, - partly observed/.style 2 args={draw, fill=#2, path picture={ - \fill[#1, sharp corners] (path picture bounding box.south west) -| - (path picture bounding box.north east) -- cycle;}, - circle} - ] - - - \node[observed] (y) {Y}; -% \node[observed,above=of y, xshift=1cm] (r) {R}; - \node[partly observed={white}{gray!40}, above=of y] (x) {X}; - \node[observed, left=of x,xshift=-1] (w) {W}; - \node[unobserved, above=of w, xshift=1cm] (k) {K}; - - \matrix [draw, below, yshift=-0.2cm, font=\small, align=center, column sep=2\pgflinewidth, inner sep=0.6em, outer sep=0em, nodes={align=center, anchor=center}] at (current bounding box.south){ - \node[observed,label=right:observed] {}; \\ - \node[unobserved,label=right:unobserved]{}; \\ - }; - - \draw[->] (x) -- (y); - \draw[->] (x) -- (w); - \draw[-] (k) -- (x); - \draw[->] (k) -- (w); - -\end{tikzpicture} -\end{document} - diff --git a/charts/example_2_dag.tex b/charts/example_2_dag.tex new file mode 100644 index 0000000..ee22941 --- /dev/null +++ b/charts/example_2_dag.tex @@ -0,0 +1,47 @@ +\documentclass[12pt]{standalone} + +\usepackage{ucs} +\usepackage[utf8x]{inputenc} + +\usepackage[T1]{fontenc} +\usepackage{textcomp} +\renewcommand{\rmdefault}{ugm} +\renewcommand{\sfdefault}{phv} +\usepackage[garamond]{mathdesign} +\usepackage{tikz} +\usetikzlibrary{positioning, shapes, arrows, shadows} + +\begin{document} + +\tikzset{ + observed/.style={circle, draw}, + partly observed/.style 2 args={draw, fill=#2, path picture={ + \fill[#1, sharp corners] (path picture bounding box.south west) -| + (path picture bounding box.north east) -- cycle;}, + circle}, + unobserved/.style={draw, circle, fill=gray!40}, + residual/.style={draw, rectangle} +} + +\tikzset{>=latex} +\begin{tikzpicture} + \node[observed] (y) {$Y$}; + \node[unobserved, above=of y] (x) {$X$}; + \node[observed, left=of x] (w) {$W$}; + + \node[observed,right=of x] (z) {$Z$}; + + \draw[->] (z) to (y); + \draw[->] (z) -- (x); + \draw[->] (x) -- (y); + \draw[->] (x) -- (w); + + \draw[->] (x) to (y); + + \draw[->] (y) -- (w); + \draw[->] (y) -- (w); + + +\end{tikzpicture} +\end{document} + diff --git a/charts/example_2_dag/.gitignore b/charts/example_2_dag/.gitignore deleted file mode 100644 index 69e1873..0000000 --- a/charts/example_2_dag/.gitignore +++ /dev/null @@ -1,12 +0,0 @@ -/auto/ -/vc -/refs-processed.bib -/*.aux -/*.bbl -/*.blg -/*.log -/*.out -/*.pdf -/*.fdb_latexmk -/*.fls -/*.ttt diff --git a/charts/example_2_dag/Makefile b/charts/example_2_dag/Makefile deleted file mode 100644 index 75fef1f..0000000 --- a/charts/example_2_dag/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/make - -all: $(patsubst %.tex,%.svg,$(wildcard *.tex)) $(patsubst %.tex,%.png,$(wildcard *.tex)) - -%.png: %.pdf - convert -density 300 -transparent white $< $@ - -%.svg: %.pdf - /usr/bin/inkscape $< --export-plain-svg=$@ - -%.pdf: %.tex - latexmk -f -pdf $< - -clean: - latexmk -C *.tex - rm -f *.tmp - rm -f vc - rm *.svg - -viewpdf: all - evince *.pdf - -vc: - vc-git - -pdf: all - -.PHONY: clean all diff --git a/charts/example_2_dag/example_2_dag.tex b/charts/example_2_dag/example_2_dag.tex deleted file mode 100644 index 07ec19c..0000000 --- a/charts/example_2_dag/example_2_dag.tex +++ /dev/null @@ -1,47 +0,0 @@ -\documentclass[12pt]{standalone} - -\usepackage{ucs} -\usepackage[utf8x]{inputenc} - -\usepackage[T1]{fontenc} -\usepackage{textcomp} -\renewcommand{\rmdefault}{ugm} -\renewcommand{\sfdefault}{phv} -\usepackage[garamond]{mathdesign} -\usepackage{tikz} -\usetikzlibrary{positioning, shapes, arrows, shadows} - -\begin{document} - -\tikzset{>=latex} -\begin{tikzpicture}[ - observed/.style={circle, draw}, - partly observed/.style 2 args={draw, fill=#2, path picture={ - \fill[#1, sharp corners] (path picture bounding box.south west) -| - (path picture bounding box.north east) -- cycle;}, - circle}, - unobserved/.style={draw, circle, fill=gray!40} - ] - - \node[observed] (y) {Y}; - \node[observed,above=of y, xshift=1cm] (r) {R}; - \node[partly observed={white}{gray!40}, left=of r] (x) {X}; - \node[observed, left=of x] (w) {W}; - \node[unobserved, above=of w, xshift=1cm] (k) {K}; - - \matrix [draw, below, yshift=-0.2cm, font=\small, align=center, column sep=2\pgflinewidth, inner sep=0.6em, outer sep=0em, nodes={align=center, anchor=center}] at (current bounding box.south){ - \node[observed,label=right:observed] {}; \\ - \node[unobserved,label=right:unobserved]{}; \\ - }; - - - \draw[->] (r) -- (y); - \draw[->] (r) -- (x); - \draw[->] (x) -- (y); - \draw[->] (x) -- (w); - \draw[->] (k) -- (x); - \draw[->] (k) -- (w); - -\end{tikzpicture} -\end{document} - diff --git a/charts/example_3_dag.tex b/charts/example_3_dag.tex new file mode 100644 index 0000000..2d1098d --- /dev/null +++ b/charts/example_3_dag.tex @@ -0,0 +1,42 @@ +\documentclass[12pt]{standalone} + +\usepackage{ucs} +\usepackage[utf8x]{inputenc} + +\usepackage[T1]{fontenc} +\usepackage{textcomp} +\renewcommand{\rmdefault}{ugm} +\renewcommand{\sfdefault}{phv} +\usepackage[garamond]{mathdesign} +\usepackage{tikz} +\usetikzlibrary{positioning, shapes, arrows, shadows} + +\begin{document} +\tikzset{ + observed/.style={circle, draw}, + partly observed/.style 2 args={draw, fill=#2, path picture={ + \fill[#1, sharp corners] (path picture bounding box.south west) -| + (path picture bounding box.north east) -- cycle;}, + circle}, + unobserved/.style={draw, circle, fill=gray!40}, + residual/.style={draw, rectangle} +} + +\tikzset{>=latex} + +\begin{tikzpicture} + \node[unobserved] (y) {$Y$}; + + \node[observed, above=of y] (x) {$X$}; + \node[observed, left=of x] (w) {$W$}; + +% \node[unobserved, above=of w] (k) {$K$}; + \node[observed,right=of x] (z) {$Z$}; +% \node[residual,below=of y] (e) {$\varepsilon$}; + % \node[residual,below=of w] (xi) {$\xi$}; + \draw[->] (z) to (y); + \draw[->] (x) -- (y); + \draw[->] (y) -- (w); +\end{tikzpicture} +\end{document} + diff --git a/charts/example_3_dag/.gitignore b/charts/example_3_dag/.gitignore deleted file mode 100644 index 69e1873..0000000 --- a/charts/example_3_dag/.gitignore +++ /dev/null @@ -1,12 +0,0 @@ -/auto/ -/vc -/refs-processed.bib -/*.aux -/*.bbl -/*.blg -/*.log -/*.out -/*.pdf -/*.fdb_latexmk -/*.fls -/*.ttt diff --git a/charts/example_3_dag/example_3_dag.tex b/charts/example_3_dag/example_3_dag.tex deleted file mode 100644 index 01f94e1..0000000 --- a/charts/example_3_dag/example_3_dag.tex +++ /dev/null @@ -1,51 +0,0 @@ -\documentclass[12pt]{standalone} - -\usepackage{ucs} -\usepackage[utf8x]{inputenc} - -\usepackage[T1]{fontenc} -\usepackage{textcomp} -\renewcommand{\rmdefault}{ugm} -\renewcommand{\sfdefault}{phv} -\usepackage[garamond]{mathdesign} -\usepackage{tikz} -\usetikzlibrary{positioning, shapes, arrows, shadows} - -\begin{document} - -\tikzset{>=latex} -\begin{tikzpicture}[ - observed/.style={circle, draw}, - partly observed/.style 2 args={draw, fill=#2, path picture={ - \fill[#1, sharp corners] (path picture bounding box.south west) -| - (path picture bounding box.north east) -- cycle;}, - circle}, - unobserved/.style={draw, circle, fill=gray!40} - ] - - \node[observed] (y) {Y}; -% \node[observed,above=of y, xshift=1cm] (r) {R}; - \node[partly observed={white}{gray!40}, above = of y] (x) {X}; - \node[observed, left=of x] (w) {W}; - \node[unobserved, above=of w, xshift=1cm] (k) {K}; - \node[unobserved, right=of k] (u) {U}; - -% \draw[->] (r) -- (y); -% \draw[->] (r) -- (x); - \draw[->] (x) -- (y); - \draw[->] (x) -- (w); - \draw[->] (x) -- (k); - \draw[->] (k) -- (w); - \draw[->] (u) to [out=270,in=30] (y); - \draw[->] (u) -- (k); - - - \matrix [draw, below, yshift=-0.2cm, inner sep=0.6em, outer sep=0em, nodes={align=center, anchor=center}] at (current bounding box.south){ - \node[observed,label=right:observed] {}; \\ - \node[unobserved,label=right:unobserved]{}; \\ - }; - - -\end{tikzpicture} -\end{document} - diff --git a/charts/example_4_dag.tex b/charts/example_4_dag.tex new file mode 100644 index 0000000..a3413c0 --- /dev/null +++ b/charts/example_4_dag.tex @@ -0,0 +1,47 @@ +\documentclass[12pt]{standalone} + +\usepackage{ucs} +\usepackage[utf8x]{inputenc} + +\usepackage[T1]{fontenc} +\usepackage{textcomp} +\renewcommand{\rmdefault}{ugm} +\renewcommand{\sfdefault}{phv} +\usepackage[garamond]{mathdesign} +\usepackage{tikz} +\usetikzlibrary{positioning, shapes, arrows, shadows} + +\begin{document} +\tikzset{ + observed/.style={circle, draw}, + partly observed/.style 2 args={draw, fill=#2, path picture={ + \fill[#1, sharp corners] (path picture bounding box.south west) -| + (path picture bounding box.north east) -- cycle;}, + circle}, + unobserved/.style={draw, circle, fill=gray!40}, + residual/.style={draw, rectangle} +} + +\tikzset{>=latex} + +\begin{tikzpicture} + \node[unobserved] (y) {$Y$}; + + \node[observed={white}{gray!40}, above=of y] (x) {$X$}; + \node[observed, left=of x] (w) {$W$}; + +% \node[unobserved, above=of w] (k) {$K$}; + \node[observed,right=of x] (z) {$Z$}; +% \node[residual,below=of y] (e) {$\varepsilon$}; +% \node[residual,below=of w] (xi) {$\xi$}; + \draw[->] (x) -- (y); +% \draw[->] (x) -- (w); + \draw[->] (y) -- (w); +% \draw[->] (k) -- (w); + \draw[->] (z) -- (y); +% \draw[->] (z) -- (k); +% \draw[->] (y) -- (xi); +% \draw[->] (w) -- (xi); +\end{tikzpicture} +\end{document} + diff --git a/charts/example_legend.tex b/charts/example_legend.tex new file mode 100644 index 0000000..e7f3eec --- /dev/null +++ b/charts/example_legend.tex @@ -0,0 +1,35 @@ +\documentclass[12pt]{standalone} + +\usepackage{ucs} +\usepackage[utf8x]{inputenc} + +\usepackage[T1]{fontenc} +\usepackage{textcomp} +\renewcommand{\rmdefault}{ugm} +\renewcommand{\sfdefault}{phv} +\usepackage[garamond]{mathdesign} +\usepackage{tikz} +\usetikzlibrary{positioning, shapes, arrows, shadows} + +\begin{document} +\tikzset{ + observed/.style={circle, draw}, + partly observed/.style 2 args={draw, fill=#2, path picture={ + \fill[#1, sharp corners] (path picture bounding box.south west) -| + (path picture bounding box.north east) -- cycle;}, + circle}, + unobserved/.style={draw, circle, fill=gray!40}, + residual/.style={draw, rectangle} +} + +\tikzset{>=latex} + +\begin{tikzpicture} + \matrix [draw, below, font=\small, align=center, column sep=2\pgflinewidth, inner sep=0.4em, outer sep=0em, nodes={align=center, anchor=center}] at (current bounding box.south){ + \node[observed,label=right:observed] {}; \\ + \node[unobserved,label=right:automatically classified]{}; \\ + \node[residual,label=right:error term]{}; \\ + }; +\end{tikzpicture} +\end{document} + diff --git a/paper b/paper new file mode 160000 index 0000000..b135cac --- /dev/null +++ b/paper @@ -0,0 +1 @@ +Subproject commit b135cac19e336001401d3ad533a12bdceab913ac