wlearn-bo Python
Python wrapper for the wlearn C11 Bayesian optimization engine.
Install
pip install wlearn-bo
Example
from wlearn_bo import BayesianOptimizer
space = {
"lr": {"type": "log_uniform", "low": 1e-4, "high": 1.0},
"depth": {"type": "int_uniform", "low": 2, "high": 12},
"booster": {"type": "categorical", "values": ["gbtree", "dart"]},
"dropout": {
"type": "uniform",
"low": 0.0,
"high": 0.5,
"condition": {"booster": "dart"},
},
}
opt = BayesianOptimizer(space, seed=42)
for _ in range(30):
params = opt.suggest()
score = evaluate(params)
opt.observe(params, score)
print(opt.best_score, opt.n_obs)
API
BayesianOptimizer(search_space, **opts)creates an optimizer.suggest()returns one parameter dict.suggest_liar(score)returns one suggestion using constant-liar batch BO.suggest_batch(n)returnsnsuggestions.observe(params, score)records a finite objective value; larger is better.n_obs,best_score,n_contextsexpose optimizer state.dispose()releases native memory early in long-running optimization services.
Search parameter types: uniform, log_uniform, int_uniform,
int_log_uniform, categorical. Conditional parameters use
condition: {parent: value}.
Options: kernel (matern52, matern32, se), acquisition_fn (ei,
ucb, pi), kappa, xi, n_restarts_hyper, n_restarts_acq, max_obs,
min_obs_for_gp, seed.
BO state is intentionally ephemeral; warm-start by replaying observe() calls.
Development
The canonical native source is repository root src/; py/csrc/ is generated
for Python builds. Use WLEARN_PYTHON=/path/to/python make test-py from the
repository root to force a specific Python environment.
Conditional parameters
Conditions may refer to parents declared later and may have multiple parents. All parents must be active and match. Missing parents and cycles are rejected; an empty condition is unconditional. Object values compare independently of key order, while booleans remain distinct from numbers. Decoding evaluates dependencies in order without changing the compiled coordinate order.
Metadata
Release files for wlearn-bo 0.1.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 | Provenance | Actions |
|---|---|---|---|---|
| wlearn_bo-0.1.0.tar.gz | 28.8 kB | Without provenance | Details for wlearn_bo-0.1.0.tar.gz |
Release files / wlearn_bo-0.1.0.tar.gz
| Download URL | wlearn_bo-0.1.0.tar.gz |
|---|---|
| Size | 28.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
81ced49f484aba135b16c64062c0cca3afcc444a157743951be37ace459bb632
|
|
BLAKE2b-256 checksum How to use checksums |
802d9efbb1cbd9f196289b26ab7c59c006ce9da1a19e18823856a12c0db7161c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Security for wlearn-bo 0.1.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.