model_report.typ 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // Per-model evaluation report.
  2. //
  3. // Data is injected as a JSON string via `sys.inputs.data` by
  4. // tasks/analysis.py (model_report). The bundled Typst compiler has no
  5. // `json.decode`, so we parse with `json(bytes(...))`.
  6. #let data = json(bytes(sys.inputs.at("data")))
  7. #set document(title: data.title)
  8. #set page(
  9. paper: "a4",
  10. margin: (x: 2cm, top: 2cm, bottom: 1.6cm),
  11. numbering: "1 / 1",
  12. )
  13. #set text(size: 10pt)
  14. #set par(justify: true)
  15. #let fmt-pct(x) = [#calc.round(x * 100, digits: 1)%]
  16. #let fmt-num(x) = [#calc.round(x, digits: 3)]
  17. // ---- Header ----
  18. #align(center)[
  19. #text(18pt, weight: "bold")[#data.title] \
  20. #v(-3pt)
  21. #text(9pt, fill: luma(110))[
  22. Generated #data.generated · schema v#data.schema_version ·
  23. seed #data.seed · commit #raw(data.git_commit)
  24. ]
  25. ]
  26. #v(2pt)
  27. #text(9pt)[*Working directory:* #raw(data.work_dir)]
  28. #line(length: 100%, stroke: 0.5pt + luma(200))
  29. #v(4pt)
  30. // ---- One section per model family ----
  31. #let family-block(fam) = {
  32. heading(level: 2, fam.name)
  33. text(9pt, fill: luma(90))[
  34. Source: #raw(fam.source + ".nc") · noise σ = #fmt-num(fam.noise_sigma) ·
  35. #fam.n_models model(s) · #fam.n_samples test samples · #fam.n_mc MC pass(es)
  36. ]
  37. v(4pt)
  38. block(fill: luma(245), inset: 8pt, radius: 4pt, width: 100%)[
  39. *Ensemble accuracy:* #fmt-pct(fam.accuracy_mean) ± #fmt-pct(fam.accuracy_std)
  40. #h(1fr) *Best member:* #fmt-pct(fam.accuracy_best)
  41. ]
  42. v(6pt)
  43. table(
  44. columns: (auto, 1fr, 1fr, 1fr),
  45. align: (col, row) => if col == 0 { left } else { right },
  46. stroke: none,
  47. inset: (x: 8pt, y: 5pt),
  48. fill: (col, row) => if row == 0 { luma(228) } else if calc.odd(row) { luma(248) },
  49. table.header(
  50. [*Model*], [*Accuracy*], [*Mean pred. entropy*], [*Mean mutual info.*],
  51. ),
  52. ..fam.models
  53. .map(m => ([#m.index], fmt-pct(m.accuracy), fmt-num(m.mean_entropy), fmt-num(m.mean_mi)))
  54. .flatten()
  55. )
  56. v(10pt)
  57. }
  58. #for fam in data.families {
  59. family-block(fam)
  60. }
  61. #v(1fr)
  62. #align(center)[#text(8pt, fill: luma(150))[ALNN evaluation harness — model report]]