Skip to content

About

Demo edition: a Gaussian process and Expected Improvement find the best material in a few tries. Still no beakers.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

Bayesian Optimization for Materials Design (Python Simulation)

Problem statement

In materials science, evaluating a candidate material (composition, processing parameters, microstructure choices) can be expensive:

  • time-consuming lab experiments
  • costly characterization and synthesis
  • limited throughput

Because each “experiment” costs a lot, we want to pick the next experiment intelligently rather than sampling randomly.

This project simulates that idea using Bayesian Optimization (BO) with a Gaussian Process (GP) surrogate model.

What this project does

  • Defines a synthetic, unknown “material property” function (a bumpy multimodal landscape)
  • Fits a Gaussian Process to noisy sampled observations
  • Uses an acquisition function (Expected Improvement or UCB) to select the next sample
  • Visualizes:
    • true function
    • GP mean prediction
    • GP uncertainty (standard deviation)
    • sampled points
    • best-observed progress over iterations

Project structure

bayesian-materials/
  main.py         # runs BO + plots results
  gp_model.py     # scikit-learn GP wrapper
  acquisition.py  # EI + UCB
  optimizer.py    # BO loop (fit -> acquire -> sample -> update)
  utils.py        # helpers (bounds, normal pdf/cdf)
  README.md

Bayesian Optimization in one paragraph

Bayesian Optimization treats the unknown objective (f(x)) (here: a material property) as something we can model probabilistically. A Gaussian Process gives a mean prediction and an uncertainty estimate. An acquisition function uses both to decide where to sample next, balancing:

  • exploitation: sample near high predicted values
  • exploration: sample where uncertainty is high and we might discover something better

Gaussian Process intuition

A GP is like a distribution over functions. After observing data points ((x_i, y_i)), it produces:

  • ( \mu(x) ): best guess of the function at (x)
  • ( \sigma(x) ): uncertainty (how unsure we are)

As you sample more points, uncertainty shrinks near observed regions.

Acquisition functions

This repo implements:

  • Expected Improvement (EI) (default): prefers points that are likely to improve over the best value seen so far
  • Upper Confidence Bound (UCB): uses ( \mu(x) + \kappa \sigma(x) ) to trade off exploration/exploitation

Requirements

pip install numpy matplotlib scikit-learn

Run

From inside bayesian-materials/:

python main.py

Try different settings:

python main.py --acq ei --iters 25
python main.py --acq ucb --iters 25
python main.py --noise-std 0.10
python main.py --save outputs/bo

Results visualization

The script shows:

  • snapshots of the surrogate model (initial, middle, final)
  • a progress curve of “best observed value so far”

You should see BO quickly focus sampling near the best peak, while still occasionally exploring uncertain regions.

Limitations

  • This demo is 1D for clear plotting; real materials design is often high-dimensional
  • Uses a dense candidate grid for acquisition maximization (fine in 1D, not scalable)
  • Synthetic function is a simplification of real experimental noise and constraints

Future work

  • Extend to multi-dimensional design spaces (2D/ND) with smarter optimizers for acquisition maximization
  • Add constraints (feasible regions, safety constraints)
  • Use real benchmark datasets or integrate with experiment/simulation pipelines
  • Multi-objective BO (tradeoffs like strength vs weight vs cost)

About

Demo edition: a Gaussian process and Expected Improvement find the best material in a few tries. Still no beakers.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages