Add optimizer comparison example: HillClimbing vs BayesianOptimizer
Description
Adds a new example optimizer_comparison_example.py to examples/gfo/ that demonstrates optimizer swapping — one of Hyperactive's core strengths. The same RandomForestClassifier experiment and search space is run with both HillClimbing and BayesianOptimizer, showing that only the optimizer line needs to change.
Related Issues
None — this is a proactive addition. No existing example in examples/gfo/ covers multiple optimizers side by side.
Type of Change
- [ ]
[BUG]- Bug fix (non-breaking change fixing an issue) - [x]
[ENH]- New feature (non-breaking change adding functionality) - [ ]
[DOC]- Documentation changes - [ ]
[MNT]- Maintenance
How was this solved?
Created a single example file that:
- Defines the experiment (
SklearnCvExperimentwithRandomForestClassifier+ 5-fold CV on Iris) once - Defines the search space once
- Runs
HillClimbingandBayesianOptimizerseparately using the exact same experiment and search space - Prints a side-by-side comparison table of best parameters and CV scores
Added optimizer comparison example (HillClimbing vs BayesianOptimizer) on RandomForest — not present in existing examples/gfo/ folder.
Checklist
- [x] PR title includes appropriate tag:
[ENH] - [ ] Linked to related issue (if applicable)
- [x] Code passes
make check(lint, format, isort) - [ ] Tests added/updated for changes (if applicable)
- [x] Documentation updated (if applicable)
Testing
Run the example directly to verify:
bash
python examples/gfo/optimizer_comparison_example.py
Expected output: best parameters and CV scores for both optimizers printed, followed by a comparison table.
Additional Notes
n_iter=30is used-->to show meaningful differences between optimizersrandom_state=42-- ensures reproducible results across runs- Every existing file in
examples/gfo/demonstrates a single optimizer only this is the first cross-optimizer comparison example
Hi, @SimonBlanke After i read the Documentation part in , when i saw the examples there this example was missing so I thought to add it . I would provide better understanding to the user for using to compare two algorithms