model_report.typ 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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") · split #raw(fam.split) ·
  35. noise σ = #fmt-num(fam.noise_sigma) ·
  36. #fam.n_models model(s) · #fam.n_samples samples · #fam.n_mc MC pass(es)
  37. ]
  38. v(4pt)
  39. block(fill: luma(245), inset: 8pt, radius: 4pt, width: 100%)[
  40. *Ensemble accuracy:* #fmt-pct(fam.accuracy_mean) ± #fmt-pct(fam.accuracy_std)
  41. #h(1fr) *Best member:* #fmt-pct(fam.accuracy_best)
  42. ]
  43. v(6pt)
  44. table(
  45. columns: (auto, 1fr, 1fr, 1fr),
  46. align: (col, row) => if col == 0 { left } else { right },
  47. stroke: none,
  48. inset: (x: 8pt, y: 5pt),
  49. fill: (col, row) => if row == 0 { luma(228) } else if calc.odd(row) { luma(248) },
  50. table.header(
  51. [*Model*], [*Accuracy*], [*Mean pred. entropy*], [*Mean mutual info.*],
  52. ),
  53. ..fam.models
  54. .map(m => ([#m.index], fmt-pct(m.accuracy), fmt-num(m.mean_entropy), fmt-num(m.mean_mi)))
  55. .flatten()
  56. )
  57. v(10pt)
  58. }
  59. #for fam in data.families {
  60. family-block(fam)
  61. }
  62. #v(1fr)
  63. #align(center)[#text(8pt, fill: luma(150))[ALNN evaluation harness — model report]]