phenotypic.tune.run_tuning#
- phenotypic.tune.run_tuning(spec: TuningSpec, images: list, output_dir: Path, *, strategy: str | None = None, n_trials: int | None = None, screen: bool = False, storage_url: str | None = None, slurm: bool = False, spec_path: Path | None = None, images_dir: Path | None = None, held_out_fraction: float | None = None, cv_group: str | None = None, n_workers: int | None = None, slurm_partition: str | None = None, slurm_mem: str | None = None, slurm_time: str | None = None, slurm_constraint: str | None = None, nrows: int | None = None, ncols: int | None = None) Trial | None[source]#
Run
specoverimagesand write thedeliverables/artifacts.Writes
trials.parquet(root) and, underdeliverables/,tuning_spec.json/best_pipeline.json/param_importance.json.--strategyoverrides the spec’s strategy (selecting the Optuna study backend for an Optuna sampler);--screenruns the two-round freeze;--storage-url/$PHENOTYPIC_TUNE_STORAGE_URLnames a shared Optuna store;--slurmsubmits a distributed worker fleet.- Parameters:
spec (TuningSpec) – The tuning recipe.
images (list) – The calibration images.
output_dir (Path) – The run directory.
strategy (str | None) – Optional
--strategyoverride (grid/random/tpe/cmaes/gp/nsga2).n_trials (int | None) – Optional trial-budget override forwarded to the strategy.
screen (bool) – Whether to run the two-round screening freeze.
storage_url (str | None) – Optional Optuna storage URL (falls back to the env var).
slurm (bool) – Whether to submit a distributed worker fleet instead of running locally.
spec_path (Path | None) – Path to the on-disk
tuning_spec.json(required for--slurmso each worker can load it).images_dir (Path | None) – The calibration image directory (required for
--slurm).held_out_fraction (float | None) – Optional
--held-out-fractionoverride of the spec’sHeldOutConfig.held_out_fraction(robust-eval).Nonekeeps the spec value. CLI flag > spec value > inference.cv_group (str | None) – Optional
--cv-groupoverride of the held-out grouping column (HeldOutConfig.group_key).Nonekeeps the spec value (then the scorer’s inferredgroupby[0]). The gap margins stay spec-only.n_workers (int | None) – Optional
--n-workersoverride of the SLURM fleet size (--slurmonly);Nonekeeps themin(8, n_trials)default.slurm_partition (str | None) – Optional
--slurm-partitionfor the worker fleet (--slurmonly);Noneomits the#SBATCH --partitiondirective (the cluster default partition).slurm_mem (str | None) – Optional
--slurm-memper worker (--slurmonly), e.g."8G";Noneomits the directive.slurm_time (str | None) – Optional
--slurm-timewall-clock limit per worker (--slurmonly), e.g."04:00:00";Noneomits the directive.slurm_constraint (str | None)
nrows (int | None)
ncols (int | None)
- Returns:
The best
Trial, orNone(e.g. a fire-and-forget SLURM submission, or no successful trial).- Return type:
Trial | None