Optimizer workflows

From VectorSpaceLab/AREX-Skill · View interactive version

Optimizer workflows is an AI agent skill from the GitHub repository VectorSpaceLab/AREX-Skill. Use BayesianOptimization for ordinary black-box optimization, manual ask-tell loops, persistence, prediction, and small ML hyperparameter optimization.

How to use this skill

Skill file

Optimizer Workflows

Use this sub-skill when a user wants to run the core bayes_opt.BayesianOptimization

lifecycle for a black-box objective or a small machine-learning hyperparameter

optimization job. This route is self-contained: future agents should not need to

open the original repository docs, notebooks, tests, or examples.

Load This When

optimize scalar parameters with Bayesian optimization.

probe, register, suggest, random_sample, set_bounds,

set_gp_params, save_state, load_state, or predict.

optimizer, resume a run, validate results, or handle duplicate/noisy

observations.

Core Rules To Apply First

  1. The package maximizes target values. Convert losses to scores, commonly by

returning -loss or using a scikit-learn scorer whose larger value is better.

  1. pbounds keys must match the objective function keyword arguments exactly.

Dict inputs are safest. Array/list inputs use the pbounds insertion order.

  1. Keep objective functions deterministic enough for the GP when possible. For

noisy objectives, set allow_duplicate_points=True only when repeated

evaluations at the same coordinates are intentional.

  1. Use f=None only for manual ask-tell loops: call suggest(), evaluate

outside the optimizer, then register(params, target). Do not call eager

probe(..., lazy=False) or maximize() with f=None.

  1. After maximize(), call predict(..., fit_gp=True) before relying on GP

predictions; the final registered point may not be included in the fitted GP

until prediction refits it.

  1. Save/load state as JSON with a newly constructed compatible optimizer: same

objective-compatible kwargs, pbounds, acquisition strategy, constraints,

duplicate policy, and any bounds transformer.

Bundled References

signatures, lifecycle semantics, TargetSpace result behavior, predict

return shapes, and state persistence details.

ask-tell evaluations, tiny HPO patterns, loss sign handling, persistence,

duplicate/noisy recipes, bounds updates, and result validation.

for key mismatches, duplicate points, unfitted GP errors, stale state loads,

target-sign mistakes, bounds/type changes, slow objectives, and f=None

misuse.

Bundled Smoke Scripts

smoke test. It runs a tiny optimizer, validates max/res, exercises

probe, register, suggest, random_sample, set_bounds, set_gp_params,

predict, duplicate handling, and optional JSON save/load.

tiny scikit-learn HPO diagnostic with synthetic data. It demonstrates both

maximizing a score and negating a loss, with safe integer casting for model

hyperparameters.

Run scripts only in an environment where bayesian-optimization and its normal

Python dependencies are installed. Both scripts support --help, use bounded

synthetic data, do not download from the network, and avoid destructive writes.

Routing Boundaries

Stay in this sub-skill for the optimizer lifecycle, public result validation,

manual ask-tell loops, persistence/resume patterns, predict semantics, noisy

or duplicate objectives, bounds updates, GP parameter tuning through

set_gp_params, and ordinary small HPO recipes.

Route elsewhere for features that have distinct APIs or deeper contracts:

and exploration/exploitation controls: ../acquisition-control/SKILL.md.

custom BayesParameter, and sequential domain reduction:

../advanced-domain-features/SKILL.md.

workflows: ../repo-maintenance/SKILL.md.

Minimal Decision Flow

  1. Identify objective type:

use ask-tell with suggest()/register().

  1. Define pbounds with exact parameter names and realistic finite bounds.

Prefer log-transformed parameters for scale-sensitive HPO (log10_C,

log_learning_rate) and transform inside the objective wrapper.

  1. Choose a budget. For smoke tests use tiny values such as init_points=2,

n_iter=2; for expensive tasks, increase only after validating objective

sign, result shape, and runtime.

  1. Run maximize(init_points=..., n_iter=...) or the ask-tell loop.
  2. Validate optimizer.max is not None, has keys target and params, all

returned params are within intended bounds, len(optimizer.res) matches the

number of registered observations, and the best target uses the intended

metric sign.

  1. Persist long or expensive runs with save_state(path). To resume, recreate a

compatible optimizer and call load_state(path) before more suggestions or

maximize(init_points=0, n_iter=...).

  1. If predictions or uncertainty are needed, call predict() with explicit

fit_gp=True after at least one observation; use return_std=True or

return_cov=True, never both.

Handoff Checklist For Future Agents

are treated as a signal to change the loop.

need has been routed to the sibling sub-skill instead of duplicated here.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.