Pipelines¶
These are the two main pipeline classes exposed at the top-level
minerva_opt namespace.
RayHyperParameterSearch¶
- class RayHyperParameterSearch(*args, **kwargs)[source]¶
Bases:
PipelineHyperparameter search pipeline using Ray Tune and PyTorch Lightning.
Supports any Ray Tune search algorithm via the
search_algparameter in_search. When no algorithm is provided, Ray’s default random/grid search is used. To use Bayesian optimisation, pass aHyperOptSearchinstance.- Variables:
- __init__(model, search_space, log_dir=None, save_run_status=True, seed=None)[source]¶
- Parameters:
model (
type) – LightningLightningModulesubclass. Each trial instantiates it withmodel(**config)whereconfigis sampled fromsearch_space.search_space (
dict) – Mapping of hyperparameter names to Ray Tune search distributions (e.g.tune.loguniform,tune.choice).log_dir (
path-like, optional) – Directory for Ray storage and run artefacts. Passed to the basePipeline.save_run_status (
bool, optional) – Whether to persist pipeline run status. Defaults toTrue.seed (
int, optional) – Global random seed forwarded to the basePipeline.
AblationStudyPipeline¶
- class AblationStudyPipeline(*args, **kwargs)[source]¶
Bases:
PipelineAblation study pipeline using Ray Tune and PyTorch Lightning.
Runs every named condition (plus the baseline) across multiple seeds so each component’s contribution can be measured by comparing against the full-model baseline. All conditions are exhaustive — no early stopping by default and no sampling; every condition × seed pair always trains to
max_epochs.- Variables:
- __init__(model, baseline_config, ablations, log_dir=None, save_run_status=True, seed=None)[source]¶
- Parameters:
model (
type) – LightningLightningModulesubclass instantiated asmodel(**config)for each trial.baseline_config (
dict) – Complete hyperparameter dict for the full (baseline) model.ablations (
dict) –Mapping of condition name → partial config override. Each entry’s values are merged on top of
baseline_configto form the condition’s full config. The key"baseline"is reserved and will raiseValueErrorif present.A single override value may be a list to sweep multiple values for that parameter. The condition is then expanded into one named condition per value, using the pattern
"{name}_{value}". For example:{"dropout": {"dropout": [0.2, 0.5, 0.8]}}
produces conditions
dropout_0.2,dropout_0.5, anddropout_0.8. Only one key per condition entry may be a list; passing multiple list-valued keys raisesValueError.log_dir (
path-likeorNone, optional) – Directory for Ray storage and run artefacts. Passed to the basePipeline.save_run_status (
bool, optional) – Whether to persist pipeline run status. Defaults toTrue.seed (
int, optional) – Base seed added to the per-trial seed offset so results are reproducible.
- Raises:
ValueError – If
"baseline"appears as a key inablations.