// Bayesian optimization partner for materials science experiments using Meta Ax. Use when researchers want to optimize material properties, formulations, or process parameters. Supports (1) Composite formulation optimization, (2) 3D printing parameter tuning, (3) Alloy composition design, (4) Any black-box optimization with continuous/categorical parameters. Handles the full workflow - setup experiments, suggest trials, validate feasibility with researcher, track results in git, generate visualizations.
| name | ax-bayesian-optimization |
| description | Bayesian optimization partner for materials science experiments using Meta Ax. Use when researchers want to optimize material properties, formulations, or process parameters. Supports (1) Composite formulation optimization, (2) 3D printing parameter tuning, (3) Alloy composition design, (4) Any black-box optimization with continuous/categorical parameters. Handles the full workflow - setup experiments, suggest trials, validate feasibility with researcher, track results in git, generate visualizations. |
Conversational Bayesian optimization for materials science. Claude handles all code; researcher just reports measurements.
Create config.json:
{
"name": "my_optimization",
"parameters": [
{"name": "temp", "type": "float", "bounds": [80, 180]},
{"name": "time", "type": "float", "bounds": [1, 8]},
{"name": "conc", "type": "float", "bounds": [0.01, 100], "scaling": "log"},
{"name": "type", "type": "choice", "values": ["A", "B", "C"]}
],
"parameter_constraints": ["temp + time <= 185"],
"objective": "strength",
"outcome_constraints": ["cost <= 100"],
"generation_strategy": {"method": "fast", "random_seed": 42}
}
Initialize:
python scripts/experiment_manager.py create --config config.json --output experiments/my_exp/
Get next trials:
python scripts/experiment_manager.py next --experiment experiments/my_exp/ --n 3
CRITICAL: Validate with researcher before they run experiments.
Report results (simple or with SEM for uncertainty):
python scripts/experiment_manager.py complete --experiment experiments/my_exp/ --trial 0 --results '{"strength": 45.2, "cost": 78}'
python scripts/experiment_manager.py complete --experiment experiments/my_exp/ --trial 0 --results '{"strength": [45.2, 1.3], "cost": [78, 2]}'
python scripts/experiment_manager.py best --experiment experiments/my_exp/
python scripts/visualization.py progress --experiment experiments/my_exp/ --output experiments/my_exp/plots/
| Command | Description |
|---|---|
create --config X --output Y | Create new experiment |
attach --experiment X --data Y | Attach existing data |
baseline --experiment X --parameters '{...}' | Set baseline for relative constraints |
next --experiment X --n N | Get N suggested trials |
complete --experiment X --trial N --results '{...}' | Report trial results (supports SEM) |
failed --experiment X --trial N --reason "..." | Mark trial as failed (equipment error) |
abandoned --experiment X --trial N --reason "..." | Mark trial as abandoned (infeasible) |
best --experiment X | Get best parameters |
pareto --experiment X | Get Pareto frontier (multi-objective) |
predict --experiment X --parameters '{...}' | Predict outcome without running |
summary --experiment X | Show experiment summary |
| Command | Description |
|---|---|
progress --experiment X --output Y | Plot optimization progress |
pareto --experiment X --output Y | Plot Pareto frontier (multi-objective) |
sensitivity --experiment X --output Y | Plot parameter sensitivity |
contour --experiment X --param1 A --param2 B --output Y | Plot 2D parameter space |
All plots generate *_preview.png at 72 DPI (safe for Claude to read).
experiments/{name}/
├── experiment.json # Ax state (for persistence)
├── config.json # Original config
├── experiment_log.md # Human-readable log
└── plots/
├── progress.png
└── progress_preview.png
After each batch of trials:
git add experiments/{name}/
git commit -m "Trials N-M: best={value}"
Lab measurements have variability. Ax handles this natively via its Gaussian Process model.
Report SEM when available (format: [mean, sem]):
python scripts/experiment_manager.py complete --experiment exp/ --trial 0 \
--results '{"strength": [45.2, 1.3], "cost": [78, 2.5]}'
For best results:
std_dev / sqrt(n_replicates)Stop optimization when any of:
Rule of thumb: Budget = 10 × number_of_parameters for initial exploration.
Equipment failure, contaminated sample:
python scripts/experiment_manager.py failed --experiment exp/ --trial 0 --reason "Equipment malfunction"
Physically impossible parameter combination:
python scripts/experiment_manager.py abandoned --experiment exp/ --trial 0 --reason "Mixture too viscous to process"
Ax learns from both. For systematic failures, consider tightening the search space.
pip install ax-platform matplotlib numpy