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#

๐Ÿ”ฌ Materials Science Focus

Specialized workflows for composition optimization, processing parameter tuning, and multi-objective materials design.

๐Ÿš€ Multiple Acquisition Functions

EI, UCB, PI, PES, KG, etc. for different optimization strategies and experimental constraints.

๐Ÿ”„ Batch Optimization

Select multiple experiments for parallel execution, dramatically reducing optimization time and cost.

๐Ÿ“Š Advanced Visualization

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:

๐Ÿš€ Getting Started

Installation, basic concepts, and your first optimization

Getting Started with Bgolearn
๐Ÿ–ฅ๏ธ BgoFace GUI

Graphical user interface for visual optimization workflows

BgoFace: Graphical User Interface for Bgolearn
๐Ÿ“– Core Documentation

API reference, acquisition functions, and optimization strategies

API Reference
๐Ÿ”ฌ Applications

Materials discovery workflows and specialized applications

Materials Discovery with Bgolearn

Detailed Navigation#

User Interfaces

๐ŸŽ“ Learning Paths#

Choose your learning path based on your background and goals:

New to Bayesian Optimization?

  1. Getting Started with Bgolearn - Installation and basic concepts

  2. Your First Optimization - Your first optimization tutorial

  3. Acquisition Functions Guide - Understanding acquisition functions

  4. Single-Objective Optimization Examples - Single-objective examples

Focused on materials discovery?

  1. Materials Discovery with Bgolearn - Materials discovery overview

  2. Single-Objective Optimization Examples - Alloy composition optimization

  3. MultiBgolearn: Multi-Objective Bayesian Global Optimization - Multi-objective optimization

  4. Multi-Objective Optimization Examples - Multi-property design examples

Ready for advanced features?

  1. Optimization Strategies - Advanced optimization strategies

  2. Surrogate Models in Bgolearn - Different surrogate models

  3. BgoFace: Graphical User Interface for Bgolearn - GUI interface for visual workflows

  4. 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! ๐Ÿš€