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: object

Wrapper around Ray’s ResultGrid providing 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 Ray ResultGrid containing all trial results.

  • _condition_names (list of str) – 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 by tune.Tuner.fit().

  • condition_names (list of str) – 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 of metric are better; "max" otherwise.

property raw: ResultGrid

Underlying ResultGrid for 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}_mean and {metric}_std for every numeric metric that was logged by at least one trial. Failed trials are excluded from the aggregation.

Returns:

Index: condition names. Columns: {metric}_mean and {metric}_std. An empty DataFrame is 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 for mode='max'.

Parameters:

metric (str or None, 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._metric value is optimal (min or max, per self._mode) is selected and its checkpoint is returned.

Parameters:

condition (str) – Name of the ablation condition (e.g. "baseline" or a key from the ablations dict).

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.