Skip to content

tune

Tune submodule for configuring optimisation jobs.

Tuner

Tuner(
    *,
    objective: ObjectiveSpec | list[ObjectiveSpec],
    parameters: list[ParameterSpec],
    num_samples: int,
    mode: Direction | list[Direction] = "max",
    max_concurrent: Optional[int] = None,
    algorithm: Optional[OptunaSpec] = None,
)

A class for running optimisation on Plugboard processes.

Instantiates the Tuner class.

Parameters:

Name Type Description Default
objective ObjectiveSpec | list[ObjectiveSpec]

The objective(s) to optimise for in the Process.

required
parameters list[ParameterSpec]

The parameters to optimise over.

required
num_samples int

The number of trial samples to use for the optimisation.

required
mode Direction | list[Direction]

The direction of the optimisation.

'max'
max_concurrent Optional[int]

The maximum number of concurrent trials. Defaults to None, which means that Ray will use its default concurrency of 1 trial per CPU core.

None
algorithm Optional[OptunaSpec]

Configuration for the underlying Optuna algorithm used for optimisation.

None

is_multi_objective property

is_multi_objective: bool

Returns True if the optimisation is multi-objective.

result_grid property

result_grid: ResultGrid

Returns a [ResultGrid][ray.tune.ResultGrid] summarising the optimisation results.

run

run(
    spec: ProcessSpec,
) -> ray.tune.Result | list[ray.tune.Result]

Run the optimisation job on Ray.

Parameters:

Name Type Description Default
spec ProcessSpec

The ProcessSpec to optimise.

required

Returns:

Type Description
Result | list[Result]

Either one or a list of [Result][ray.tune.Result] objects containing the best trial

Result | list[Result]

result. Use the result_grid property to get full trial results.