This repository contains Python workflows and experimental datasets for applying Bayesian Optimization to chemical reaction optimization. The project leverages BayBE as its primary Bayesian optimization framework to conduct an iterative active learning campaign designed to maximize key performance metrics such as Ultra-Performance Liquid Chromatography (UPLC) peak area and chemical yield (%).
Optimizing chemical reactions often requires navigating complex parameter spaces comprising continuous variables (e.g., temperature, reaction time, stoichiometry) and discrete or categorical choices (e.g., solvents, catalysts, ligands). This repository provides a structured, step-by-step experimental campaign using BayBE to suggest optimal next-round laboratory conditions.
- Powered by BayBE: Built using EMD Group's BayBE framework specifically tailored for digital chemistry and experimental design.
- Iterative Campaign Notebooks: Step-by-step optimization rounds (
campaign/) tracking progressive improvements in UPLC area and reaction yield. - Experimental Datasets: Complete tabular records (
data_set/) in CSV and Excel formats containing input conditions and measured output responses. - Quick-Start Example: A standalone notebook (
optimization_example.ipynb) demonstrating the core Bayesian Optimization pipeline.
bayesopt_python/
├── campaign/ # Iterative campaign notebooks
│ ├── optimization.ipynb # Initial baseline optimization round
│ ├── optimization_2_UPLC_area.ipynb # Iteration 2: Targeted UPLC peak area
│ ├── optimization_3_yield.ipynb # Iteration 3: Targeted chemical yield
│ ├── optimization_4_UPLC_area.ipynb # Iteration 4: Refined UPLC peak area
│ ├── optimization_5_yield.ipynb # Iteration 5: Refined yield optimization
│ ├── optimization_6_UPLC_area_final.ipynb # Final UPLC area evaluation
│ ├── optimization_7_yield_final.ipynb # Final yield evaluation
│ └── optimization_8_just_suggestion.ipynb # Next-step experimental candidate generator
│
├── data_set/ # Experimental datasets (CSV & XLSX)
│ ├── result.xlsx # Raw/initial experimental results
│ ├── result_UPLC_area.csv # Campaign data filtered for UPLC area
│ ├── result_UPLC_area.xlsx # Excel version of UPLC area dataset
│ ├── result_yield.csv # Campaign data filtered for reaction yield
│ ├── result_UPLC_area_yield.csv # Combined UPLC area & yield dataset
│ ├── result_all.csv / .xlsx # Complete combined experimental records
│ ├── result_final.csv / .xlsx # Finalized dataset post-campaign
│ └── result_trimmed.xlsx # Processed/trimmed parameter subset
│
├── optimization_example.ipynb # Standalone template & tutorial notebook
└── README.md # Repository documentation
The optimization process follows an active learning loop implemented with BayBE:
-
Parameter & Target Definition: Define chemical search spaces (continuous parameters, discrete choices) and optimization objectives within BayBE target spaces.
-
Surrogate Modeling: Fit Gaussian Process (GP) surrogate models
$f(\mathbf{x}) \sim \mathcal{GP}(m(\mathbf{x}), k(\mathbf{x}, \mathbf{x}'))$ to predict response metrics$y = f(\mathbf{x}) + \epsilon$ . -
Acquisition Function & Recommendation: Compute acquisition scores
$\alpha(\mathbf{x})$ (such as Expected Improvement$\text{EI}(\mathbf{x})$ or Upper Confidence Bound$\text{UCB}(\mathbf{x})$ ) to select candidate conditions:$$\mathbf{x}_{\text{next}} = \arg\max _{\mathbf{x} \in \mathcal{X}} \alpha(\mathbf{x})$$ -
Experimental Execution: Run laboratory experiments at
$\mathbf{x}_{\text{next}}$ and measure output metrics (UPLC peak area, reaction yield). -
Iteration: Feed new data back into the BayBE campaign instance to generate recommendations for subsequent rounds.
Install Python 3.10+ along with BayBE and standard data science packages:
pip install baybe pandas numpy matplotlib jupyterlab-
Clone the repository:
git clone https://github.com/cmcwf/bayesopt_python.git cd bayesopt_python -
Launch Jupyter Lab:
jupyter lab
-
Explore the Quick-Start Notebook: Open
optimization_example.ipynbto see how BayBE targets, parameters, and campaign instances are configured. -
Follow the Campaign Steps: Browse through the
campaign/directory sequentially to inspect each iteration of the chemical optimization process.
- UPLC Peak Area: Used as a proxy for product formation or relative purity obtained via Ultra-Performance Liquid Chromatography.
- Reaction Yield (%): Measured isolated or quantitative reaction yield percentage.
This project is open-source and available under the MIT License.
- Primary Bayesian Optimization Framework: BayBE (EMD Group)
- For questions or issues regarding this repository, please open an issue in GitHub.