Skip to main content

Experimental design and Bayesian optimization with Gaussian Processes and QMC sampling

Project description

ChemBayes

ChemBayes is a Python library designed to streamline experimental design (DoE) and Bayesian optimization for scientific and chemical research. It leverages Gaussian Processes to model complex response surfaces and efficiently identify optimal conditions.

🚀 Key Features

  • Intelligent Sampling (QMC): Generate initial experimental designs using Halton sequences (Quasi-Monte Carlo) for optimal space-filling coverage.
  • Automatic Preprocessing: Integrated handling of numeric variables (scaling) and categorical variables (one-hot encoding).
  • Hyperparameter Tuning: Automated Gaussian Process parameter adjustment (Matern + WhiteKernel) using Leave-One-Out (LOO) cross-validation and NLPD loss.
  • Bayesian Optimization: Global maximum search using the Expected Improvement (EI) acquisition function.
  • Visual Diagnostics: Automated generation of feature importance, partial dependence plots (1D and 2D), and model validation charts.

📦 Installation

You can install the latest stable version directly from PyPI:

pip install chembayes

Alternatively, for local development, you can install from the project root:

pip install .

Or for development mode:

pip install -e .

🛠️ Quick Start

1. Generating an Experimental Design (Sampling)

Define your search space with numeric and categorical parameters:

import chembayes as cb

parameters = {
    'temperature': {'type': 'float', 'l_bound': 20.0, 'u_bound': 100.0},
    'time': {'type': 'int', 'l_bound': 5, 'u_bound': 60},
    'catalyst': {'type': 'categoric', 'categories': ['Pd', 'Ni', 'Cu']}
}

# Generate 20 optimal experimental points
df_experiments = cb.qmc_sampling(parameters, n_points=20)

# Visualize the distribution
cb.plot_qmc_sampling(df_experiments)

2. Bayesian Optimization

Once you have experimental data, find the optimal conditions:

# Define input features and the target column
inputs = ['temperature', 'time', 'catalyst']
output = 'yield'

# Run the complete optimization pipeline
results = cb.optimize_experiment(
    df=df_data, 
    inputs=inputs, 
    output=output,
    n_tuning_trials=50,
    n_opt_trials=100
)

# Access the best found parameters
print(f"Best configuration: {results['best_params']}")

📂 Project Structure

  • src/chembayes/sampler.py: Tools for QMC sample generation.
  • src/chembayes/optimizer.py: Bayesian optimization engine and Gaussian Processes.
  • src/chembayes/__init__.py: Public API exposure.
  • pyproject.toml: Modern package configuration and dependencies.

✉️ Contact & Contribution

Author: Jesus Alberto Martin del Campo
Email: j.a.martin-campo@hotmail.com
GitHub: jesusalmartin/chembayes

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chembayes-0.1.3.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chembayes-0.1.3-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file chembayes-0.1.3.tar.gz.

File metadata

  • Download URL: chembayes-0.1.3.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for chembayes-0.1.3.tar.gz
Algorithm Hash digest
SHA256 4490adffaace22bbca4ca570dbaa74ae914a84866a1004f71a70b5a7f57900d1
MD5 e184ad52bf9fce2bc257612eff2c0dbc
BLAKE2b-256 ac2e458d64f6d647b3babfbf5d036b8d4e071afafebc79cc7b43f5b0adea66d0

See more details on using hashes here.

Provenance

The following attestation bundles were made for chembayes-0.1.3.tar.gz:

Publisher: publish.yml on jesusalmartin/chembayes

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file chembayes-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: chembayes-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for chembayes-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 8d54522abfa9e27dc01540cd558bf8d4acfcc445ae4bdabe7c1203ada5f99c90
MD5 09d7cd2e73d858dfd9a689e8084b1438
BLAKE2b-256 fb93ed14c42205911f5c6cdbb749374172f512366c4a9f0c2811f8c5d34e8a3e

See more details on using hashes here.

Provenance

The following attestation bundles were made for chembayes-0.1.3-py3-none-any.whl:

Publisher: publish.yml on jesusalmartin/chembayes

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page