Global-Local-Unexplored Sampling Strategy for Bayesian Optimization
Project description
aichem-gloss
Global-Local-Unexplored Sampling Strategy (GLOSS)
Overview
aichem-gloss is a Python package that implements the GLOSS algorithm, a optimization recommender that combines three complementary search strategies:
- Global Search: Explores the parameter space using acquisition functions with uncertainty quantification (UCB/LCB)
- Local Search: Exploits promising regions around the best known points for refinement
- Unexplored Search: Discovers underexplored regions of the parameter space with distance-based filtering
This package is particularly useful for:
- 🧪 Chemical space exploration and molecular design
- 🔬 Materials discovery and optimization
- ⚙️ Hyperparameter optimization for machine learning
- 🎯 Any expensive black-box optimization problem
- 🤖 Robotic chemistry and automated experimentation
Features
- ✨ Three-strategy approach: Balanced exploration and exploitation with unexplored region discovery
- 🔄 Strict deduplication: Ensures diverse and non-redundant recommendations
- 🎯 Model-agnostic: Works with any scikit-learn compatible model (GP, RF, etc.)
- 🚀 Easy to use: Simple API with sensible defaults
- 📊 Well-documented: Comprehensive documentation and examples
- 🔧 Flexible: Customizable strategy distribution and acquisition parameters
Installation
From PyPI
pip install aichem-gloss
From Conda
conda install -c conda-forge aichem-gloss
From Source
git clone https://github.com/pic-ai-robotic-chemistry/aichem-gloss.git
cd aichem-gloss
pip install -e .
Quick Start
import numpy as np
from sklearn.gaussian_process import GaussianProcessRegressor
from aichem_gloss import GLOSSRecommender
# Define parameter bounds
bounds = [[-5, 5], [-5, 5]]
# Create and train a surrogate model
model = GaussianProcessRegressor()
X_train = np.random.uniform(-5, 5, (20, 2))
y_train = np.sum(X_train**2, axis=1) # Example objective
model.fit(X_train, y_train)
# Create GLOSS recommender
recommender = GLOSSRecommender(
model=model,
bounds=bounds,
y_better_is_smaller=True, # Minimization problem
kappa=1.96, # Exploration parameter
exploration_fraction=0.5
)
# Fit with historical data
recommender.fit(X_train, y_train)
# Get recommendations
suggestions = recommender.suggest(n_recommend=8)
print("Recommended points:", suggestions['mixed'])
Documentation
Full documentation is available at aichem-gloss.readthedocs.io
Examples
Check out the examples directory for more detailed usage examples:
basic_usage.py: Basic optimization with Gaussian Process- Using with Random Forest models
- Custom acquisition functions
- Multi-objective optimization scenarios
Algorithm Details
The GLOSS algorithm distributes recommendations across three strategies:
Strategy Distribution
- For
n_recommend > 3:- Global: 50% of recommendations (exploration with UCB/LCB)
- Local: 25% of recommendations (exploitation around best points)
- Unexplored: 25% of recommendations (distance-based unexplored search)
- For
n_recommend ≤ 3: All recommendations use global search
Key Features
- Strict Sequential Deduplication: Each new candidate is checked against all previously generated points to ensure diversity
- Dynamic History Injection: The unexplored search dynamically updates its reference points to avoid recently generated candidates
- Adaptive Repulsion Radius: Automatically calculated based on the density of historical points
- Fallback Mechanisms: Multiple fallback strategies ensure robust recommendation generation
API Overview
GLOSSRecommender
GLOSSRecommender(
model=None, # Surrogate model (scikit-learn compatible)
bounds=None, # Parameter bounds [[min, max], ...]
y_better_is_smaller=False, # True for minimization, False for maximization
kappa=1.96, # Exploration-exploitation trade-off
exploration_fraction=0.5 # Unexploredd region threshold (0.0-0.99)
)
Main Methods
fit(X, y): Fit the recommender with historical datasuggest(n_recommend): Generate new candidate pointsget_num_recommends(n_recommend): Calculate strategy distribution
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Citation
If you use this package in your research, please cite:
@software{aichem_gloss,
title = {aichem-gloss: Global-Local-Unexplored Sampling Strategy for Bayesian Optimization},
author = {Zhang, B.},
year = {2025},
url = {https://github.com/pic-ai-robotic-chemistry/aichem-gloss}
}
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Developed by the PIC AI Robotic Chemistry team
- Inspired by Bayesian optimization and active learning research
- Built with NumPy and SciPy
Contact
- Author: B. Zhang
- Email: zbc@ustc.edu.cn
- Organization: PIC AI Robotic Chemistry
- GitHub: pic-ai-robotic-chemistry
Related Projects
- scikit-optimize: Bayesian optimization library
- GPyOpt: Gaussian Process optimization
- Ax: Adaptive experimentation platform
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aichem_gloss-1.0.0.tar.gz.
File metadata
- Download URL: aichem_gloss-1.0.0.tar.gz
- Upload date:
- Size: 27.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e75f3ee37d6ed7352f8968cb9b267cfefa16a82b04177d009342913fe501aa1e
|
|
| MD5 |
311a0e8a2bac42576b5f9deb6fba43b1
|
|
| BLAKE2b-256 |
fbd03f60f67d47ba21a35692d24380357bf7f481248a886565b4a6dc1f2b0f9b
|
File details
Details for the file aichem_gloss-1.0.0-py3-none-any.whl.
File metadata
- Download URL: aichem_gloss-1.0.0-py3-none-any.whl
- Upload date:
- Size: 10.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dce8105bcb84d0402b0222d7abb0f993af6acd8d53e1d41428170f2acd78559b
|
|
| MD5 |
6054c5882ed51f481e1cae6f9b8536bc
|
|
| BLAKE2b-256 |
ddbaac417d6931273abe1a2b9e153bc924598183075c21020895f80ab8dc299f
|