Skip to main content

A lightweight hyperparameter optimization tool using Sobol sequences.

Project description

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 allows for sequential optimization, you can 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 allows you to optimize any scikit-learn compatible estimator class (e.g., SVC, XGBClassifier, GradientBoostingRegressor) hyperparameters efficiently by covering the search space more evenly than random search.

Installation

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

1. Basic Usage (Random Forest)

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
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)
optimizer.optimize(X, y, n_samples=8, batch_name="Batch 1")

# 5. Extend Optimization (Phase 2 - fills gaps in Phase 1)
optimizer.optimize(X, y, n_samples=8, batch_name="Batch 2")

# 6. Get Results
print(optimizer.get_best_params())
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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

elementary_hpo-0.1.2.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

elementary_hpo-0.1.2-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file elementary_hpo-0.1.2.tar.gz.

File metadata

  • Download URL: elementary_hpo-0.1.2.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for elementary_hpo-0.1.2.tar.gz
Algorithm Hash digest
SHA256 59eadbee29eb413beb764fe6b368e2db5e8d36669f0069e1c278c9014d8dd999
MD5 285cacf9d7c8ddda63cb7423d1b6e564
BLAKE2b-256 4c2158ac6265f497205cf2111407d810728c35b8ccbc2d295cbe45a01ecff0bb

See more details on using hashes here.

Provenance

The following attestation bundles were made for elementary_hpo-0.1.2.tar.gz:

Publisher: publish.yml on BetikuOluwatobi/elementary-hpo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file elementary_hpo-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: elementary_hpo-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for elementary_hpo-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 38c91c98772ff7003f06be300b78fd0c67864834982add35988a9be287b24391
MD5 106ef2fed15214b6b5a71c383d96bcff
BLAKE2b-256 5ae43da5bb2b5582870d3bb903c56e76b19ebda991842019d11d9860a989f846

See more details on using hashes here.

Provenance

The following attestation bundles were made for elementary_hpo-0.1.2-py3-none-any.whl:

Publisher: publish.yml on BetikuOluwatobi/elementary-hpo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page