Compare commits

..

32 Commits

Author SHA1 Message Date
000749add1 Fix typos 2026-01-30 13:01:57 +01:00
3fc312ba9d Add gen_histogram.py and finish theory for exercise 2 2026-01-22 13:35:38 +01:00
0716f02766 Add most theory for exercise 2 2026-01-21 17:51:32 +01:00
7b0fbb0262 Add gen_correlated_data.py and finish theory for exercise 1 2026-01-21 16:39:01 +01:00
31b40de191 Add summary slide for theory 1 2026-01-21 10:26:08 +01:00
41294cf3bf Change slide overlays 2026-01-21 10:09:53 +01:00
e8c8f0ed13 Formatting 2026-01-21 09:53:48 +01:00
dfc558ca16 Add solution for exercise 2c 2026-01-21 09:53:26 +01:00
6098da86fa Add solution to exercise 2b 2026-01-20 17:13:02 +01:00
f92ed7d66d Change decimal points to commas 2026-01-20 16:49:19 +01:00
e8781c5ef4 Add solution to exercise 2a 2026-01-20 16:45:49 +01:00
e19254a82f Remove unnecessary text, split title into multiple lines 2026-01-20 15:13:56 +01:00
15ca83ca76 Add solution for exercise 1 2026-01-20 15:09:50 +01:00
a1fb10842d Add exercises 1 and 2 2026-01-20 14:01:54 +01:00
081cad7f11 Fix factorial symbol and change variable k to n 2026-01-17 17:55:45 +01:00
9f422f859e Fix handout compilation 2026-01-17 17:55:37 +01:00
c23ac95b90 Make build system compatible with tikz externalization 2026-01-17 11:47:54 +01:00
7640d83c37 Move and rename slides 2026-01-16 04:23:32 +01:00
25e25a366f Finish explanation slides 2026-01-16 02:32:40 +01:00
54407061a0 Add slide explaining marginals and transformations 2026-01-16 01:21:48 +01:00
33ff39f974 Add Poisson distribution explanation 2026-01-16 00:26:18 +01:00
8eb3a6378f Add summary slide for exercise 1 2026-01-15 03:38:23 +01:00
876bbad136 Add solution for 2b 2026-01-15 03:26:33 +01:00
587d894e5e Add formulas to summary slide of section 2 2026-01-15 00:42:44 +01:00
6eee07a720 Add solution for exercise 2c 2026-01-15 00:15:05 +01:00
6f7dbe5018 Remove equation number 2026-01-14 01:30:50 +01:00
8dad61d27a Finish solution for exercise 2a 2026-01-14 01:30:12 +01:00
23e14d74a8 Add first version of solution for exercise 2a 2026-01-14 01:07:47 +01:00
ddd70cae86 Insert pause in solution to exercise 1a 2026-01-14 00:19:06 +01:00
a4df0108de Add solution for exercise 1b 2026-01-14 00:16:19 +01:00
dcd018c236 Add solution to exercise 1a 2026-01-13 23:59:40 +01:00
7e67ee3792 Add slides with exercises for tutorial 5 2025-12-21 16:24:43 +01:00
6 changed files with 2436 additions and 6 deletions

View File

@ -1,4 +1,3 @@
$pdflatex="pdflatex -shell-escape -interaction=nonstopmode -synctex=1 %O %S";
$out_dir = 'build';
$pdf_mode = 1;

View File

@ -1,19 +1,25 @@
PRESENTATIONS := $(patsubst src/%/presentation.tex,build/presentation_%.pdf,$(wildcard src/*/presentation.tex))
HANDOUTS := $(patsubst build/presentation_%.pdf,build/presentation_%_handout.pdf,$(PRESENTATIONS))
RC_PDFLATEX := $(shell grep '$$pdflatex' .latexmkrc \
| sed -e 's/.*"\(.*\)".*/\1/' -e 's/%S//' -e 's/%O//')
.PHONY: all
all: $(PRESENTATIONS) $(HANDOUTS)
build/presentation_%.pdf: src/%/presentation.tex build/prepared
TEXINPUTS=./lib/cel-slides-template-2025:$$TEXINPUTS latexmk $<
mv build/presentation.pdf $@
TEXINPUTS=./lib/cel-slides-template-2025:$(dir $<):$$TEXINPUTS \
latexmk -outdir=build/$* $<
cp build/$*/presentation.pdf $@
build/presentation_%_handout.pdf: src/%/presentation.tex build/prepared
TEXINPUTS=./lib/cel-slides-template-2025:$$TEXINPUTS latexmk -pdflatex='pdflatex %O "\def\ishandout{1}\input{%S}"' $<
mv build/presentation.pdf $@
TEXINPUTS=./lib/cel-slides-template-2025:$(dir $<):$$TEXINPUTS \
latexmk -outdir=build/$*_handout \
-pdflatex='$(RC_PDFLATEX) %O "\def\ishandout{1}\input{%S}"' $<
cp build/$*_handout/presentation.pdf $@
build/prepared:
mkdir -p build
mkdir build
touch build/prepared
.PHONY: clean

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,38 @@
import numpy as np
import matplotlib.pyplot as plt
from numpy.typing import NDArray
import argparse
def twodim_array_to_pgfplots_table_string(a: NDArray):
return (
" \\\\\n".join([" ".join([str(vali) for vali in val]) for val in a]) + "\\\\\n"
)
def main():
# Parse command line arguments
parser = argparse.ArgumentParser()
parser.add_argument("--correlation", "-c", type=np.float32, required=True)
parser.add_argument("-N", type=np.int32, required=True)
parser.add_argument("--plot", "-p", action="store_true")
args = parser.parse_args()
# Generate & plot data
means = np.array([0, 0])
cov = np.array([[1, args.correlation], [args.correlation, 1]])
x = np.random.multivariate_normal(means, cov, size=args.N)
print(twodim_array_to_pgfplots_table_string(x))
if args.plot:
plt.scatter(x[:, 0], x[:, 1])
plt.show()
if __name__ == "__main__":
main()

View File

@ -0,0 +1,40 @@
import argparse
import numpy as np
import matplotlib.pyplot as plt
from scipy.special import binom
def array_to_pgfplots_table_string(a):
return " ".join([f"({k}, {val})" for (k, val) in enumerate(a)]) + f" ({len(a)}, 0)"
def P_binom(N, p, k):
return binom(N, k) * p**k * (1 - p) ** (N - k)
def main():
# Parse command line arguments
parser = argparse.ArgumentParser()
parser.add_argument("-N", type=np.int32, required=True)
parser.add_argument("-p", type=np.float32, required=True)
parser.add_argument("--show", "-s", action="store_true")
args = parser.parse_args()
# Generate and show data
N = args.N
p = args.p
bars = np.array([P_binom(N, p, k) for k in range(N + 1)])
print(array_to_pgfplots_table_string(bars))
if args.show:
plt.stem(bars)
plt.show()
if __name__ == "__main__":
main()

File diff suppressed because it is too large Load Diff