brainstorming
brainstorming
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).
samplers-prunersChoose, configure, customize, and debug Optuna search and pruning algorithms, including TPE, random, grid, CMA-ES, QMC, NSGA-II/III, GP, brute force, median, percentile, successive halving, Hyperband, threshold, patient, and Wilcoxon.
Independent GitHub snapshot · Automated classification · Original documentation governs
Use this sub-skill when the task is about selecting or configuring Optuna's sampler= or pruner=, implementing a custom BaseSampler or BasePruner, or debugging algorithm-specific behavior.
optuna.samplers.*, optuna.pruners.*, optuna.search_space.*, sampler/pruner constructor arguments, constraints_func, pruning reports, grid exhaustion, and optional algorithm dependencies.Study.optimize, Study.ask, Study.tell, callbacks, and trial state lifecycle to optimization-workflows.cli-and-storage.analysis-visualization.artifacts-integrations.optuna.samplers.TPESampler(seed=...) and optuna.pruners.MedianPruner(...) or HyperbandPruner(...) when the objective reports reliable intermediate values.TPESampler(multivariate=True, group=True, seed=...); it supports categorical parameters and conditional search spaces better than CMA-ES, QMC, or GP.GridSampler(search_space, seed=...); use sampler.is_exhausted(study) or omit n_trials when the study should stop after all grid points are evaluated.RandomSampler(seed=...) for robustness, and avoid expecting bit-for-bit reproducibility with Study.optimize(..., n_jobs != 1).GPSampler(seed=...) if torch is installed; otherwise fall back to TPE or random.CmaEsSampler(seed=...) if the cmaes package is installed; otherwise fall back to TPE/random.NSGAIISampler(...), NSGAIIISampler(...), RandomSampler, TPESampler, QMCSampler, or BruteForceSampler; do not use pruners for multi-objective studies.WilcoxonPruner(p_threshold=..., n_startup_steps=...) only when scipy is installed.import optuna
sampler = optuna.samplers.TPESampler(
seed=42,
multivariate=True,
group=True,
constant_liar=True,
)
pruner = optuna.pruners.HyperbandPruner(
min_resource=1,
max_resource="auto",
reduction_factor=3,
)
study = optuna.create_study(direction="minimize", sampler=sampler, pruner=pruner)
For pruning to have any effect, the objective must report intermediate values and raise optuna.TrialPruned() when trial.should_prune() returns true:
for step in range(max_steps):
score = train_one_step(...)
trial.report(score, step)
if trial.should_prune():
raise optuna.TrialPruned()
For a deterministic executable check, run the bundled smoke script from the Optuna skill directory:
python sub-skills/samplers-pruners/scripts/sampler_pruner_smoke.py
references/algorithm-reference.md maps Optuna sampler/pruner families to supported search-space shapes, objectives, budgets, optional dependencies, and constructor snippets.references/customization.md shows custom BaseSampler and BasePruner patterns, intersection_search_space, constraints, and safe fallback design.references/troubleshooting.md covers optional dependency absence, invalid arguments, grid exhaustion, pruning no-ops, reproducibility, and workflow-specific edge cases.group=True plus a single-objective pruner is safer than CMA-ES/QMC/GP.GridSampler stops early after exhausting combinations and a separate CmaEsSampler attempt fails because the optional cmaes dependency is not installed.