xnn.common.benchmark.report#

Tabulate benchmark results and write them in user-selectable formats.

A benchmark result is a table: a list of row dicts sharing a common set of columns (model and split first, then one column per target_metric). columns() derives the ordered column list from the rows.

Writers follow the same name -> callable registry pattern as the model and metric registries, so new output formats – including user-defined ones – are added without touching the core. The built-ins are csv, json and md (GitHub-flavored Markdown). write() dispatches one format; write_all() writes several and returns the paths. format_table() renders the same rows as an aligned plain-text table for stdout.

Functions

apply_units(rows, units)

Relabel row keys with their units, for unit-annotated file output.

available_writers()

List the names of all registered results writers.

columns(rows)

Derive the ordered column list spanning all result rows.

format_table(rows[, units])

Render results as an aligned monospaced table for printing.

register_writer(name)

Return a decorator registering a results writer under name.

write(rows, fmt, path[, cols])

Write results in a single registered format.

write_all(rows, formats, out_dir, filename)

Write results to every requested format under one directory.

write_csv(rows, cols, path)

Write rows as CSV with a header line.

write_json(rows, cols, path)

Write rows as a JSON array of objects (column order preserved).

write_markdown(rows, cols, path)

Write rows as a GitHub-flavored Markdown table.