Hyperparameter Tuning Kit
Optuna/Ray Tune configs, search space definitions, pruning strategies, and distributed tuning setups.
📄 Product Preview
Try the interactive reader and demo tools below, or get the full product with all content unlocked.
📖 Interactive Reader (Free Preview) ⚙ Try Demo Tools 📦 Download Free Sample📁 File Structure 18 files
📖 Documentation Preview README excerpt
Hyperparameter Tuning Kit
A practical hyperparameter optimization toolkit built around a single idea: define
your search space once and run it on both Optuna and Ray Tune without
rewriting anything. Ships with cross-validated objectives, median/percentile
pruning, ASHA/PBT scheduling, multi-objective support, and backend-agnostic result
analysis.
The core (search spaces, pruning, objectives, analysis) depends only on the Python
standard library — it imports and its full test suite runs with no third-party
packages at all. Optuna and Ray Tune are imported lazily, so you install only the
backend you actually use.
Features
- One declarative search space, two backends.
SearchSpacecompiles to the
Optuna suggest API and to a Ray Tune param_space dict — no drift between them.
- Typed parameters —
FloatParameter,IntParameter,CategoricalParameter
with log scaling, step grids, and validation that rejects impossible ranges.
- Cross-validated objectives —
Objectivewraps stdlib K-fold CV with a
per-fold pruning hook and first-class multi-objective support.
- Pruning in plain Python —
MedianPruner,PercentilePruner,
ThresholdPruner, and EarlyStopping, with startup/warmup/interval gates you can
unit-test and reason about (and convert to real Optuna pruners on demand).
- Optuna runner — samplers (TPE, CMA-ES, QMC, random, grid), pruning, SQLite
persistence, resume, and multi-objective studies via a declarative StudyConfig.
- Ray Tune runner — ASHA, Population Based Training, and median stopping via a
declarative TuneConfig, plus per-trial resources.
- Result analysis — best/top-k trials, a fast parameter-importance proxy,
Pareto fronts, convergence history, and CSV/JSON export over a single
TrialRecord type that works regardless of backend.
- A zero-dependency example that runs the moment you unzip the kit.
What's included
hyperparameter-tuning-kit/
├── src/hpo/
│ ├── search_spaces.py # SearchSpace + typed params + RandomTrial (stdlib)
│ ├── pruning.py # median/percentile/threshold pruners + early stopping
│ ├── objective.py # scorers, K-fold CV, Objective (multi-objective)
│ ├── analysis.py # best/top-k, importance, Pareto, export (stdlib)
│ ├── optuna_search.py # StudyConfig + run_study (lazy `optuna`)
│ └── ray_tune_search.py # TuneConfig + run_tune, ASHA/PBT (lazy `ray`)
├── examples/
│ ├── random_search_baseline.py # runs on stdlib alone — start here
│ ├── optuna_sklearn.py # tunes a GradientBoostingClassifier with Optuna
│ └── ray_tune_torch.py # tunes a PyTorch MLP with Ray Tune + ASHA
├── guides/
│ ├── hpo-guide.md # samplers, pruning, schedulers, budgets, pitfalls
│ └── search-space-design.md # log scales, ranges, conditionals, worked spaces
├── tests/
│ ├── test_search_spaces.py
│ ├── test_pruning.py
│ └── test_objective.py
├── README.md
└── LICENSE
Quick start
... continues with setup instructions, usage examples, and more.