jobs.AdaptiveSweepResult

jobs.AdaptiveSweepResult(
    job_results=list(),
    succeeded=0,
    failed=0,
    study=None,
    best_params=None,
    best_value=None,
)

Results from running an adaptive (Optuna) sweep.

Extends SweepResult with Optuna-specific fields for tracking the optimization process and accessing the best results.

Attributes

Name Type Description
job_results list[tuple[ExpandedJob, Any]] List of (ExpandedJob, CLIResult) tuples.
succeeded int Number of successful trials.
failed int Number of failed trials.
study Any The Optuna study object (for advanced analysis).
best_params dict[str, Any] | None Parameters that achieved the best objective value.
best_value float | None Best objective value found.

Examples

>>> result = run_adaptive_sweep(cli, config, registry=registry, ...)
>>> print(f"Best params: {result.best_params}")
>>> print(f"Best value: {result.best_value}")
>>>
>>> # Access trial history
>>> for metric in result.trial_metrics:
...     print(metric)
>>>
>>> # Get summary statistics
>>> summary = result.get_trial_summary()
>>> print(f"Mean: {summary['mean_value']}")

Methods

Name Description
get_best_job Get the job with best objective value.
get_trial_summary Get summary statistics for the adaptive sweep.

get_best_job

jobs.AdaptiveSweepResult.get_best_job()

Get the job with best objective value.

Returns

Name Type Description
ExpandedJob | None ExpandedJob with best metric, or None if no successful trials.

Examples

>>> best_job = result.get_best_job()
>>> if best_job:
...     print(f"Best config: {best_job.parameters}")

get_trial_summary

jobs.AdaptiveSweepResult.get_trial_summary()

Get summary statistics for the adaptive sweep.

Returns

Name Type Description
dict[str, Any] Dict with keys:
dict[str, Any] - n_trials: Total trials
dict[str, Any] - n_completed: Trials with valid metrics
dict[str, Any] - n_failed: Trials that failed or returned inf
dict[str, Any] - best_value: Best objective value
dict[str, Any] - best_params: Parameters that achieved best value
dict[str, Any] - mean_value: Mean of completed trial values
dict[str, Any] - std_value: Std deviation of completed trial values

Examples

>>> summary = result.get_trial_summary()
>>> print(f"Completed: {summary['n_completed']}/{summary['n_trials']}")
>>> print(f"Best: {summary['best_value']}")