Elementary HPO
Elementary-hpo is a lightweight hyperparameter optimization library built on Sobol Sequences (Quasi-Monte Carlo methods).
It is designed to offer a mathematically superior alternative to Grid Search and Random Search by generating low-discrepancy sequences that cover the hyperparameter search space more evenly and efficiently. Unlike standard Random Search, elementary-hpo is sequential and deterministic, allowing you to pause a search, analyze results, and generate new hyperparameter candidates that mathematically fill the "gaps" of previous runs without redundancy.
Based on concepts discussed in the research paper Hyperparameter Optimization in Machine Learning, this package optimizes any scikit-learn compatible estimator (e.g., SVC, XGBClassifier, GradientBoostingRegressor).
🚀 Key Features
- Gap-Filling Strategy: Unlike Random Search, which can cluster points wastefully, Sobol sequences are designed to fill the empty spaces in your search grid progressively.
- Pause & Resume: Run a batch of 10 trials, check the results, and run 10 more. The optimizer remembers where it left off and continues exploring new areas of the hyperparameter space.
- Scikit-Learn Compatible: Works seamlessly with any estimator that follows the sklearn API.
- Lightweight: Minimal dependencies, focused purely on efficient parameter generation.
Installation
Using pip
pip install elementary-hpo
Using Poetry
If you are using Poetry for your project, add it as a dependency:
poetry add elementary-hpo
Quick Start
Basic Usage (Random Forest)
Here is a complete example of how to optimize a Random Forest classifier.
from sklearn.datasets import make_classification
from elementary_hpo import SobolOptimizer, plot_optimization_results, plot_space_coverage
# 1. Generate Data
X, y = make_classification(n_samples=1000, n_features=20, random_state=42)
# 2. Define Search Space
# Keys must match the estimator's parameter names
param_bounds = {
'n_estimators': (50, 300), # Integer tuple = Numerical range
'max_depth': (3, 20),
'min_samples_split': (0.01, 0.5), # Float tuple = Numerical range
'criterion': ['gini', 'entropy'] # List = Categorical choices
}
# 3. Initialize Optimizer
optimizer = SobolOptimizer(param_bounds)
# 4. Run Optimization (Phase 1)
# Optimizes a hypothetical estimator logic (or pass your actual model training function here)
optimizer.optimize(X, y, n_samples=8, batch_name="Batch 1")
# 5. Extend Optimization (Phase 2)
# This second run automatically detects the previous points and fills the "gaps"
optimizer.optimize(X, y, n_samples=8, batch_name="Batch 2")
# 6. Analyze Results
print("Best Parameters:", optimizer.get_best_params())
# Visualizations
plot_optimization_results(optimizer.results)
plot_space_coverage(optimizer.results, x_col="n_estimators", y_col="max_depth")
Citation
If you use this package, please consider citing the foundational paper:
"Hyperparameter Optimization in Machine Learning" (2024). arXiv:2410.22854. Available at: https://arxiv.org/abs/2410.22854
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the project
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
License
This project is licensed under the Apache License - see the LICENSE file for details.
Metadata
Release files for elementary-hpo 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| elementary_hpo-0.2.0.tar.gz | 10.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| elementary_hpo-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.0 kB
Release files / elementary_hpo-0.2.0.tar.gz
| Download URL | elementary_hpo-0.2.0.tar.gz |
|---|---|
| Size | 10.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c1c7d4a37ec4f8e991ce50b9e62da584333f812632861291d0197860f6651717
|
|
BLAKE2b-256 checksum How to use checksums |
3e5b4d99761941298e7b14176dd6ea8a39542f44bd75e86af7918f4df4eb9e7b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 1, 2026.
Transparency logRelease files / elementary_hpo-0.2.0-py3-none-any.whl
| Download URL | elementary_hpo-0.2.0-py3-none-any.whl |
|---|---|
| Size | 11.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7ca7ac9884131925ac02de893e4ae37d218c44b442e779ce9e5eba9d6959e1b9
|
|
BLAKE2b-256 checksum How to use checksums |
841fba704531afc459e012aa5eade11b0e79aa0b915c4cae8c17c9afd68addb2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 1, 2026.
Transparency log