Bgolearn Documentation#
Note
Welcome to the comprehensive documentation for Bgolearn - a powerful Bayesian Global Optimization package designed specifically for materials discovery and scientific research.
๐ฏ What is Bgolearn?
Bgolearn is a Python package developed by Bin Cao at Hong Kong University of Science and Technology (Guangzhou) that implements state-of-the-art Bayesian optimization algorithms for both single-objective and multi-objective optimization. Itโs particularly powerful for materials discovery, where experiments are costly and time-consuming.
Key Features:
Single-objective optimization with multiple acquisition functions
Multi-objective optimization via MultiBgolearn
Materials-focused design and applications
Flexible surrogate model selection
Bootstrap uncertainty quantification
What makes Bgolearn special?
Materials-focused: Built specifically for materials science workflows
Parallel experiments: Batch optimization for efficient resource utilization
Rich visualizations: Interactive plots and optimization dashboards
Robust & reliable: Comprehensive error handling and data validation
Easy to use: Simple API with sensible defaults
Acknowledgment
The Bgolearn project received funding from the Shanghai Artificial Intelligence Open Source Award Project Support Plan (ไธๆตทๅธไบบๅทฅๆบ่ฝๅผๆบๅฅๅฑ้กน็ฎๆฏๆ่ฎกๅ, 2025), with special thanks to Prof. Jie Xiong and Prof. Tong-Yi Zhang from Shanghai University for their support and guidance.
Key Features#
Specialized workflows for composition optimization, processing parameter tuning, and multi-objective materials design.
EI, UCB, PI, PES, KG, etc. for different optimization strategies and experimental constraints.
Select multiple experiments for parallel execution, dramatically reducing optimization time and cost.
Interactive plots, optimization dashboards, and materials-specific visualizations for better insights.
Quick Start Example#
1from Bgolearn import BGOsampling
2import pandas as pd
3import numpy as np
4
5# Load your materials data
6X_train = pd.DataFrame(np.random.randn(20, 3), columns=['Temperature', 'Pressure', 'Composition'])
7y_train = pd.Series(np.random.randn(20)) # Target property (e.g., strength)
8X_candidates = pd.DataFrame(np.random.randn(100, 3), columns=['Temperature', 'Pressure', 'Composition'])
9
10# Initialize and fit Bgolearn
11optimizer = BGOsampling.Bgolearn()
12model = optimizer.fit(
13 data_matrix=X_train, # Pass DataFrame directly
14 Measured_response=y_train, # Pass Series directly
15 virtual_samples=X_candidates, # Pass DataFrame directly
16 opt_num=1
17)
18
19# Get recommendation using Expected Improvement
20ei_values, recommended_points = model.EI()
21
22# The recommended point(s)
23next_experiment = recommended_points[0] # First (best) recommendation
24print(f"Next recommended experiment: {next_experiment}")
25
26# Get prediction for all virtual samples
27predicted_values = model.virtual_samples_mean
28print(f"Number of predictions: {len(predicted_values)}")
29
30# Basic visualization using matplotlib
31import matplotlib.pyplot as plt
32
33# Plot EI values
34plt.figure(figsize=(10, 6))
35plt.plot(ei_values)
36plt.title('Expected Improvement Values')
37plt.xlabel('Candidate Index')
38plt.ylabel('EI Value')
39plt.show()
๐ฆ Installation#
pip install bgolearn
git clone https://github.com/Bin-Cao/Bgolearn.git
cd Bgolearn
pip install -e .
# Complete installation with all features
pip install bgolearn[all]
# Or install specific components
pip install bgolearn plotly seaborn # For advanced visualization
pip install bgolearn pymatgen matminer # For materials science
Verify Installation
from Bgolearn import BGOsampling
print("Bgolearn imported successfully!")
# Test basic functionality
opt = BGOsampling.Bgolearn()
print("Bgolearn optimizer initialized successfully!")
๐๏ธ Documentation Structure#
This documentation is organized into several main sections:
Installation, basic concepts, and your first optimization
Graphical user interface for visual optimization workflows
API reference, acquisition functions, and optimization strategies
Materials discovery workflows and specialized applications
๐ Learning Paths#
Choose your learning path based on your background and goals:
New to Bayesian Optimization?
Getting Started with Bgolearn - Installation and basic concepts
Your First Optimization - Your first optimization tutorial
Acquisition Functions Guide - Understanding acquisition functions
Single-Objective Optimization Examples - Single-objective examples
Focused on materials discovery?
Materials Discovery with Bgolearn - Materials discovery overview
Single-Objective Optimization Examples - Alloy composition optimization
MultiBgolearn: Multi-Objective Bayesian Global Optimization - Multi-objective optimization
Multi-Objective Optimization Examples - Multi-property design examples
Ready for advanced features?
Optimization Strategies - Advanced optimization strategies
Surrogate Models in Bgolearn - Different surrogate models
BgoFace: Graphical User Interface for Bgolearn - GUI interface for visual workflows
MultiBgolearn: Multi-Objective Bayesian Global Optimization - Multi-objective optimization
๐ค Community & Support#
Get Help & Connect
๐ฌ GitHub Discussions: Ask questions and share experiences
๐ Issues: Report bugs and request features
๐ง Email: binjacobcao@gmail.com
๐ Documentation: Youโre reading it!
๐ Citation#
If you use Bgolearn in your research, please cite our work:
@article{cao2024active,
title={Active learning accelerates the discovery of high strength and high ductility lead-free solder alloys},
author={Cao, Bin and Su, Tianhao and Yu, Shuting and Li, Tianyuan and Zhang, Taolue and Zhang, Jincang and Dong, Ziqiang and Zhang, Tong-Yi},
journal={Materials \& Design},
volume={241},
pages={112921},
year={2024},
publisher={Elsevier}
}
๐ License#
MIT License
Bgolearn is released under the MIT License, making it free for both academic and commercial use. See the full license for details.
Ready to accelerate your research? Start here or explore our examples to see Bgolearn in action! ๐