latent.stats.markdown¶
Human-readable renderings of statistical reports (FR-8.2).
Two renderers over one presentation policy: :func:render_markdown (pipe-table
markdown for artifacts/Studio) and :func:render_text (aligned plain text for
flow logs — what LT004 points a hand-rolled rich statistics table at).
Functions¶
render_markdown¶
Render a StatisticalReport as a markdown string.
Produces tables for: - Metrics (estimate, CI, method, n) - Comparisons (delta, CI, p-value, effect size) - Gates (pass/fail, threshold, actual, strictness, direction) - Ordinal distributions (level, label, proportion, CI, passing) - Drift results (severity, delta, CI, p-value, effect size) - Power analysis (sample size, MDE, power, alpha) - Category breakdown (per-category metrics with CIs) - Failure modes (mode, count, proportion) - Records preview (first 10 records with scores)
Args: report: A fully populated StatisticalReport.
Returns: Markdown-formatted string.
render_text¶
Render a StatisticalReport as an aligned plain-text block.
The terse, log-safe counterpart of :func:render_markdown — metric/CI
table, gate verdict table (with the stamped comparison direction), a
sampled-run banner, and a gates: n/m passed verdict line. No ANSI
escapes, no markdown. Pure: no logging or IO; publish_report logs
the result via the flow logger.
This is what LT004 offers in place of a rich table in a flow module.
It does not replace print(f"processed {n}") — that is a log line, and
LT004 points it at latent.prefect.logger instead.