Phase 6: Report generation#180
Conversation
|
Before we go further in the review of this implementation, I want you to think through some scenarios:
Walk through how a user would achieve each of these with the current |
|
You're right, the current I see two ways to fix this: Option A : composable cells Instead of a single import lambkin.data.report as report
nb = report.notebook()
nb.add(report.timeseries("output.ape.zip", title="APE"))
nb.add(report.timeseries("output.rpe.zip", title="RPE"))
nb.add(report.stats_table("output.ape.zip"))
nb.save(output_dir / "report.ipynb")This handles all three scenarios cleanly. More API surface, but fully flexible. Option B : Keep a single entry point but make it configurable: report.generate(
ctx,
files=["output.ape.zip", "output.rpe.zip"],
sections=["timeseries", "stats"],
)Which direction do you prefer? |
Signed-off-by: Maria Teresa Ortega <teresa.ortega0903@gmail.com>
Signed-off-by: Maria Teresa Ortega <teresa.ortega0903@gmail.com>
Signed-off-by: Maria Teresa Ortega <teresa.ortega0903@gmail.com>
Signed-off-by: Maria Teresa Ortega <teresa.ortega0903@gmail.com>
Signed-off-by: Maria Teresa Ortega <teresa.ortega0903@gmail.com>
Signed-off-by: Maria Teresa Ortega <teresa.ortega0903@gmail.com>
Signed-off-by: Maria Teresa Ortega <teresa.ortega0903@gmail.com>
eb5d7ca to
4576a93
Compare
Signed-off-by: Maria Teresa Ortega <teresa.ortega0903@gmail.com>
Signed-off-by: Maria Teresa Ortega <teresa.ortega0903@gmail.com>
Signed-off-by: Maria Teresa Ortega <teresa.ortega0903@gmail.com>
| ### Analysing results in a notebook | ||
|
|
||
| `lambkin.data` functions accept a plain path, so results can be explored | ||
| from a Jupyter notebook without re-running the benchmark: |
There was a problem hiding this comment.
Framing: The subject should be the notebook as a workflow, not lambkin.data. Something like:
Benchmark results can be explored interactively in a Jupyter notebook after a run. The included report.ipynb provides a starting point; lambkin.data functions accept a plain path so no benchmark context is needed:
| ```python | ||
| from collections import defaultdict | ||
|
|
||
| import matplotlib.pyplot as plt | ||
| import numpy as np | ||
| import pandas as pd | ||
|
|
||
| from lambkin.data import access, evo as evo_data | ||
|
|
||
| RESULTS_DIR = "path/to/results" | ||
|
|
||
| # List completed iterations | ||
| for entry in access.iterations(RESULTS_DIR): | ||
| print(entry.variant, entry.iteration, vars(entry.params)) | ||
|
|
||
| # Plot APE timeseries per variant | ||
| series = evo_data.series(RESULTS_DIR, "output.ape.zip") | ||
| for entry in series: | ||
| plt.plot(entry.time, entry.error, label=entry.variant, alpha=0.5) | ||
| plt.legend() | ||
| plt.show() | ||
|
|
||
| # Convert to a long-format DataFrame for seaborn | ||
| rows = [] | ||
| for entry in evo_data.stats(RESULTS_DIR, "output.ape.zip"): | ||
| row = vars(entry.params).copy() | ||
| row.update({"variant": entry.variant, "iteration": entry.iteration, | ||
| "rmse": entry.rmse, "mean": entry.mean, "max": entry.max}) | ||
| rows.append(row) | ||
| df = pd.DataFrame(rows) |
There was a problem hiding this comment.
The code snippet also reads like a Python script — using print() and plt.show() — which works against the notebook framing. In a notebook, cell outputs render inline; you don't need either.
Rather than writing a new snippet, just point to the Beluga example notebook and note that it can be adapted for different metrics. That's faster and more honest about what the user should actually do.
| jupyter notebook examples/beluga/report.ipynb | ||
| ``` | ||
|
|
||
| The notebook plots APE timeseries by variant, prints a stats summary table, and generates an RMSE comparison bar chart. All figures are saved under `results/`. |
There was a problem hiding this comment.
in a notebook, outputs render inline, nothing is "printed". Change to "displays" or "shows".
| The notebook plots APE timeseries by variant, prints a stats summary table, and generates an RMSE comparison bar chart. All figures are saved under `results/`. | |
| The notebook plots APE timeseries by variant, shows a stats summary table, and generates an RMSE comparison bar chart. All figures are saved under `results/`. |
Proposed changes
Adds
examples/beluga/report.ipynb, a Jupyter cookbook that shows how to explore and visualise APE results from a completed Beluga benchmark run usinglambkin.data.accessandlambkin.data.evo.The notebook covers:
access.iterations().jupyter nbconvert.No new SDK modules or dependencies are introduced — the notebook uses only the existing
lambkin.dataAPI.Type of change
💥 No breaking changes
Checklist
Put an
xin the boxes that apply. This is simply a reminder of what we will require before merging your code.Additional comments
N/A