BayesianOptimization Repo Skill
Use this repo skill when a user asks about the bayesian-optimization package,
its bayes_opt import, Gaussian-process Bayesian optimization, black-box
function maximization, small hyperparameter optimization, acquisition functions,
constraints, typed/categorical parameters, sequential domain reduction, or
maintaining this package's source checkout.
This skill is self-contained. Do not send future agents to original repository
notebooks or examples for package usage; use the bundled references and scripts
below. Checkout-only test and docs commands are confined to the maintainer
sub-skill.
Install and import baseline
Package users normally install one of:
pip install bayesian-optimization
conda install -c conda-forge bayesian-optimization
Minimal import check:
from bayes_opt import BayesianOptimization
def objective(x, y):
return -x**2 - (y - 1.0) ** 2 + 1.0
optimizer = BayesianOptimization(
f=objective,
pbounds={"x": (-2.0, 2.0), "y": (-3.0, 3.0)},
random_state=1,
verbose=0,
)
optimizer.maximize(init_points=1, n_iter=1)
assert optimizer.max is not None
For an environment-level diagnostic, run
scripts/check_env.py. Add --run-subskill-smokes when
you want it to execute the bundled tiny smoke helpers as well.
Route map
Core optimizer and HPO workflows
Read sub-skills/optimizer-workflows/SKILL.md
when the task involves:
- creating
BayesianOptimization(f=..., pbounds=...);
maximize, max, res, probe, register, suggest, or random_sample;
- manual ask-tell loops for external evaluations;
- saving/loading JSON state, changing bounds, tuning GP parameters, or using
predict;
- converting a loss into a maximization target;
- small scikit-learn HPO recipes and validation.
Acquisition control
Read sub-skills/acquisition-control/SKILL.md
when the task involves:
- UCB, Expected Improvement, Probability of Improvement, Constant Liar, or
GPHedge;
- choosing exploration/exploitation settings such as
kappa, xi,
exploration_decay, and exploration_decay_delay;
- lower-level acquisition
suggest(gp, target_space, n_random, n_smart, ...);
- asynchronous/batch-like suggestions, acquisition portfolios, or custom
AcquisitionFunction subclasses;
- acquisition errors such as empty target spaces, invalid
xi/kappa, stale
UtilityFunction snippets, and constraint incompatibility.
Advanced domain features
Read sub-skills/advanced-domain-features/SKILL.md
when the task involves:
- SciPy
NonlinearConstraint and ConstraintModel;
- known constrained observations with
constraint_value;
- integer bounds
(low, high, int), categorical bounds, or custom
BayesParameter subclasses;
TargetSpace array/dict conversion, masks, and typed kernel transforms;
SequentialDomainReductionTransformer, minimum_window, and all-float
domain reduction limitations.
Repository maintenance
Read sub-skills/repo-maintenance/SKILL.md
only when the user is editing or validating a bayesian-optimization source
checkout. It covers focused pytest selection, Ruff/lint commands, notebook/docs
checks, CI Python/NumPy matrix behavior, dependency markers, build validation,
and release/publish boundaries. Do not use it for ordinary package usage.
Cross-cutting references
references/troubleshooting.md: install,
import, dependency marker, no-CLI, old API, and route-selection failures that
cut across sub-skills.
references/repo-provenance.md: source
commit, package version, evidence paths, and refresh baseline for this skill.
references/repo-routing-metadata.json:
structured metadata consumed by DisCo's managed repo-skills router importer.
Quick decisions
- The package maximizes. If the real metric is a loss, return
-loss.
pbounds names must match objective and constraint keyword arguments.
- No GPU backend is required for selected package workflows; this is a CPU
scientific Python package built on NumPy, SciPy, and scikit-learn.
- There is no public package CLI. Use Python APIs and bundled diagnostic
scripts.
- Avoid old code that calls
optimizer.suggest(UtilityFunction(...)); current
v3.3.x optimizer-level suggest() takes no acquisition argument. Pass an
acquisition instance into the optimizer constructor instead.
- Use dict parameters for clarity, especially with typed or categorical
domains. Raw arrays follow
pbounds insertion order and expanded internal
dimensions.
Handoff checklist
Before answering a user or running a diagnostic, identify:
- Is this package usage or source-checkout maintenance?
- Is the objective unconstrained or constrained?
- Are parameters ordinary floats, typed integers/categories, or custom domain
objects?
- Is acquisition selection part of the task, or can the optimizer default be
used?
- Does the requested check require only CPU runtime dependencies, or a broader
development environment for notebooks/docs/lint?
Then load the smallest matching sub-skill and use its bundled references and
scripts.
1---2name: bayesian-optimization3description: "Route BayesianOptimization package tasks for black-box Bayesian4 optimization, HPO, acquisition functions, constraints, typed domains, domain5 reduction, and checkout maintenance."6disable-model-invocation: true7metadata:8 source: https://skillmd.com/skills/vectorspacelab/bayesian-optimization9 disco-role: operating10license: MIT11---1213# BayesianOptimization Repo Skill1415Use this repo skill when a user asks about the `bayesian-optimization` package,16its `bayes_opt` import, Gaussian-process Bayesian optimization, black-box17function maximization, small hyperparameter optimization, acquisition functions,18constraints, typed/categorical parameters, sequential domain reduction, or19maintaining this package's source checkout.2021This skill is self-contained. Do not send future agents to original repository22notebooks or examples for package usage; use the bundled references and scripts23below. Checkout-only test and docs commands are confined to the maintainer24sub-skill.2526## Install and import baseline2728Package users normally install one of:2930```bash31pip install bayesian-optimization32conda install -c conda-forge bayesian-optimization33```3435Minimal import check:3637```python38from bayes_opt import BayesianOptimization394041def objective(x, y):42 return -x**2 - (y - 1.0) ** 2 + 1.04344optimizer = BayesianOptimization(45 f=objective,46 pbounds={"x": (-2.0, 2.0), "y": (-3.0, 3.0)},47 random_state=1,48 verbose=0,49)50optimizer.maximize(init_points=1, n_iter=1)51assert optimizer.max is not None52```5354For an environment-level diagnostic, run55[`scripts/check_env.py`](scripts/check_env.py). Add `--run-subskill-smokes` when56you want it to execute the bundled tiny smoke helpers as well.5758## Route map5960### Core optimizer and HPO workflows6162Read [`sub-skills/optimizer-workflows/SKILL.md`](sub-skills/optimizer-workflows/SKILL.md)63when the task involves:6465- creating `BayesianOptimization(f=..., pbounds=...)`;66- `maximize`, `max`, `res`, `probe`, `register`, `suggest`, or `random_sample`;67- manual ask-tell loops for external evaluations;68- saving/loading JSON state, changing bounds, tuning GP parameters, or using69 `predict`;70- converting a loss into a maximization target;71- small scikit-learn HPO recipes and validation.7273### Acquisition control7475Read [`sub-skills/acquisition-control/SKILL.md`](sub-skills/acquisition-control/SKILL.md)76when the task involves:7778- UCB, Expected Improvement, Probability of Improvement, Constant Liar, or79 GPHedge;80- choosing exploration/exploitation settings such as `kappa`, `xi`,81 `exploration_decay`, and `exploration_decay_delay`;82- lower-level acquisition `suggest(gp, target_space, n_random, n_smart, ...)`;83- asynchronous/batch-like suggestions, acquisition portfolios, or custom84 `AcquisitionFunction` subclasses;85- acquisition errors such as empty target spaces, invalid `xi`/`kappa`, stale86 `UtilityFunction` snippets, and constraint incompatibility.8788### Advanced domain features8990Read [`sub-skills/advanced-domain-features/SKILL.md`](sub-skills/advanced-domain-features/SKILL.md)91when the task involves:9293- SciPy `NonlinearConstraint` and `ConstraintModel`;94- known constrained observations with `constraint_value`;95- integer bounds `(low, high, int)`, categorical bounds, or custom96 `BayesParameter` subclasses;97- `TargetSpace` array/dict conversion, masks, and typed kernel transforms;98- `SequentialDomainReductionTransformer`, `minimum_window`, and all-float99 domain reduction limitations.100101### Repository maintenance102103Read [`sub-skills/repo-maintenance/SKILL.md`](sub-skills/repo-maintenance/SKILL.md)104only when the user is editing or validating a `bayesian-optimization` source105checkout. It covers focused pytest selection, Ruff/lint commands, notebook/docs106checks, CI Python/NumPy matrix behavior, dependency markers, build validation,107and release/publish boundaries. Do not use it for ordinary package usage.108109## Cross-cutting references110111- [`references/troubleshooting.md`](references/troubleshooting.md): install,112 import, dependency marker, no-CLI, old API, and route-selection failures that113 cut across sub-skills.114- [`references/repo-provenance.md`](references/repo-provenance.md): source115 commit, package version, evidence paths, and refresh baseline for this skill.116- [`references/repo-routing-metadata.json`](references/repo-routing-metadata.json):117 structured metadata consumed by DisCo's managed repo-skills router importer.118119## Quick decisions120121- The package maximizes. If the real metric is a loss, return `-loss`.122- `pbounds` names must match objective and constraint keyword arguments.123- No GPU backend is required for selected package workflows; this is a CPU124 scientific Python package built on NumPy, SciPy, and scikit-learn.125- There is no public package CLI. Use Python APIs and bundled diagnostic126 scripts.127- Avoid old code that calls `optimizer.suggest(UtilityFunction(...))`; current128 v3.3.x optimizer-level `suggest()` takes no acquisition argument. Pass an129 acquisition instance into the optimizer constructor instead.130- Use dict parameters for clarity, especially with typed or categorical131 domains. Raw arrays follow `pbounds` insertion order and expanded internal132 dimensions.133134## Handoff checklist135136Before answering a user or running a diagnostic, identify:1371381. Is this package usage or source-checkout maintenance?1392. Is the objective unconstrained or constrained?1403. Are parameters ordinary floats, typed integers/categories, or custom domain141 objects?1424. Is acquisition selection part of the task, or can the optimizer default be143 used?1445. Does the requested check require only CPU runtime dependencies, or a broader145 development environment for notebooks/docs/lint?146147Then load the smallest matching sub-skill and use its bundled references and148scripts.