Results¶
AblationResults¶
AblationResults is returned by
_ablate()
and provides ablation-specific aggregation and analysis on top of Ray’s
ResultGrid.
- class AblationResults(result_grid, condition_names, metric, mode)[source]¶
Bases:
objectWrapper around Ray’s
ResultGridproviding ablation-specific analysis.Aggregates trial results across seeds per condition, computes metric deltas relative to the baseline condition, and provides checkpoint access per condition.
- Variables:
_grid (
ResultGrid) – Underlying RayResultGridcontaining all trial results._condition_names (
listofstr) – Ordered list of condition names (baseline first)._metric (
str) – Primary metric name used for ranking and delta computation._mode (
str) –"min"or"max"— optimisation direction for_metric.
- __init__(result_grid, condition_names, metric, mode)[source]¶
- Parameters:
result_grid (
ray.tune.result_grid.ResultGrid) – Full grid of trial results produced bytune.Tuner.fit().condition_names (
listofstr) – Ordered list of condition names used to index the results (baseline must be first).metric (
str) – Name of the primary evaluation metric.mode (
str) –"min"if lower values ofmetricare better;"max"otherwise.
- property raw: ResultGrid¶
Underlying
ResultGridfor direct Ray API access.- Returns:
The unmodified result grid produced by
tune.Tuner.fit().- Return type:
ray.tune.result_grid.ResultGrid
- summary()[source]¶
Compute mean and standard deviation of all metrics per condition.
Each row corresponds to one condition in declaration order (baseline first). Columns are named
{metric}_meanand{metric}_stdfor every numeric metric that was logged by at least one trial. Failed trials are excluded from the aggregation.- Returns:
Index: condition names. Columns:
{metric}_meanand{metric}_std. An emptyDataFrameis returned when no successful trial results are available.- Return type:
pandas.DataFrame
- delta_from_baseline(metric=None)[source]¶
Compute per-condition improvement relative to the baseline.
Positive values mean the condition performs better than baseline — lower mean loss for
mode='min', higher mean score formode='max'.- Parameters:
metric (
strorNone, optional) – Metric to use for the comparison. Defaults to the metric supplied at construction time (self._metric).- Returns:
Index: condition names. Values: signed delta versus the baseline mean. Series name is
"delta_{metric}_vs_baseline".- Return type:
pandas.Series- Raises:
KeyError – If the requested metric is not present in
summary()columns.
- best_checkpoint(condition)[source]¶
Retrieve the best checkpoint for a given condition.
Among all seeds for the condition, the seed whose final reported
self._metricvalue is optimal (min or max, perself._mode) is selected and its checkpoint is returned.- Parameters:
condition (
str) – Name of the ablation condition (e.g."baseline"or a key from theablationsdict).- Returns:
Ray checkpoint object for the winning seed of
condition.- Return type:
ray.train.Checkpoint- Raises:
ValueError – If no successful trial results exist for
condition.