bencher.optuna_conversions
Functions
|
use optuna to perform a grid search |
|
|
|
Given a trial produce a string summary of the best results |
Convert a sweep var to an optuna distribution |
|
|
Converts from a sweep var to an optuna |
|
Append a plot to row, logging any exception instead of propagating. |
|
Like _append_safe but sets a consistent width on the resulting plotly figure. |
Module Contents
- bencher.optuna_conversions.optuna_grid_search(bench_cfg: bencher.bench_cfg.BenchCfg, trial_vars: list | None = None) optuna.Study
use optuna to perform a grid search
- Parameters:
bench_cfg (BenchCfg) – setting for grid search
trial_vars (list | None) – If provided, use these variables for the search space. Otherwise, filter bench_cfg.all_vars by optimize=True.
- Returns:
results of grid search
- Return type:
optuna.Study
- bencher.optuna_conversions.param_importance(bench_cfg: bencher.bench_cfg.BenchCfg, study: optuna.Study, plot_width: int | None = None) panel.Column
- bencher.optuna_conversions.summarise_trial(trial: optuna.trial, bench_cfg: bencher.bench_cfg.BenchCfg) list[str]
Given a trial produce a string summary of the best results
- Parameters:
trial (optuna.trial) – trial to summarise
bench_cfg (BenchCfg) – info about the trial
- Returns:
Summary of trial
- Return type:
list[str]
- bencher.optuna_conversions.sweep_var_to_optuna_dist(var: param.Parameter) optuna.distributions.BaseDistribution
Convert a sweep var to an optuna distribution
- Parameters:
var (param.Parameter) – A sweep var
- Raises:
ValueError – Unsupported var type
- Returns:
Optuna representation of a sweep var
- Return type:
optuna.distributions.BaseDistribution
- bencher.optuna_conversions.sweep_var_to_suggest(iv: bencher.variables.parametrised_sweep.ParametrizedSweep, trial: optuna.trial) object
Converts from a sweep var to an optuna
- Parameters:
iv (ParametrizedSweep) – A parametrized sweep input variable
trial (optuna.trial) – Optuna trial used to define the sample
- Raises:
ValueError – Unsupported var type
- Returns:
A sampled variable (can be any type)
- Return type:
Any
- bencher.optuna_conversions.cfg_from_optuna_trial(trial: optuna.trial, bench_cfg: bencher.bench_cfg.BenchCfg, cfg_type: bencher.variables.parametrised_sweep.ParametrizedSweep) bencher.variables.parametrised_sweep.ParametrizedSweep
- bencher.optuna_conversions._append_safe(row, plot_fn, *args, **kwargs)
Append a plot to row, logging any exception instead of propagating.
- bencher.optuna_conversions._append_safe_sized(row, plot_fn, width, *args, **kwargs)
Like _append_safe but sets a consistent width on the resulting plotly figure.