Bayesian Optimization framework for simulated material discovery. Implements the Active Learning Loop used in computational materials science: a probabilistic surrogate model guides experimental design, selecting the most informative composition to test next rather than relying on exhaustive grid search.
This approach is widely used in alloy design, where each experiment (melting, casting, testing) is expensive. By using Gaussian Process regression as a surrogate and acquisition functions to balance exploration vs. exploitation, the optimizer finds optimal compositions in far fewer experiments than random search.
+-------------------+
| Objective Func | Synthetic material property
| (ground truth) | landscape (Branin, Hartmann,
+--------+----------+ SteelHardness)
|
| evaluate
v
+-------------+ +-------------------+ +-------------------+
| Acquisition | -> | Bayesian Optimizer| -> | GP Surrogate |
| Function | | (Active Learning | | (Matern 5/2 kern) |
| EI/UCB/PI | | Loop) | | scikit-learn |
+-------------+ +-------------------+ +-------------------+
|
v
+-------------------+
| Visualization | Convergence, acquisition
| (matplotlib) | landscape, regret plots
+-------------------+
Active Learning Loop:
- GP surrogate predicts material properties + uncertainty from observed data
- Acquisition function selects the most informative next experiment
- Ground truth function evaluates the selected composition
- Model updates with the new observation
- Repeat until budget exhausted
| Function | Dimensions | Simulates | Key Feature |
|---|---|---|---|
| Branin | 2 | 2-component alloy | 3 global optima, tests exploration |
| Hartmann-3 | 3 | 3-component alloy | Complex landscape, 1 global optimum |
| SteelHardness | 3 | C-Mn-Temperature | Physically motivated hardness model |
# Clone and install
git clone https://github.com/gilito11/bayesian-forge.git
cd bayesian-forge
pip install -r requirements.txt
# Run full comparison (all functions, EI vs UCB vs Random)
python demo.py
# Run specific function with specific acquisition
python demo.py --function branin --acquisition ucb --iterations 40
# Run steel hardness with Expected Improvement
python demo.py -f steel -a ei -n 50======================================================================
SUMMARY TABLE
======================================================================
Function Method Best Optimum Gap
----------------------------------------------------------------------
Branin (2-component alloy) EI -0.3979 -0.3979 0.0000
Branin (2-component alloy) UCB -0.3980 -0.3979 0.0001
Branin (2-component alloy) Random -0.5134 -0.3979 0.1155
Hartmann-3 (3-component alloy) EI 3.8560 3.8628 0.0068
Hartmann-3 (3-component alloy) UCB 3.8491 3.8628 0.0137
Hartmann-3 (3-component alloy) Random 3.2104 3.8628 0.6524
Steel Hardness (C-Mn-T) EI 66.89 67.50 0.61
Steel Hardness (C-Mn-T) UCB 66.45 67.50 1.05
Steel Hardness (C-Mn-T) Random 58.32 67.50 9.18
Plots are saved to output/:
*_convergence.png- Best value vs evaluation number*_regret.png- Cumulative regret over time*_exploration.png- Sampling pattern (first 2 dims)*_landscape.png- 4-panel acquisition landscape (2D functions only)
bayesian-forge/
forge/
materials.py # Synthetic objective functions (ground truth)
surrogate.py # Gaussian Process surrogate (scikit-learn)
acquisition.py # EI, UCB, PI acquisition functions
optimizer.py # Main Bayesian Optimization loop
plots.py # Publication-quality visualizations
demo.py # Entry point with CLI
requirements.txt
Eric Gil -- BSc Computer Science, Universitat de Lleida
MIT License. See LICENSE.