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.5.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.5-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: chembayes-0.1.5.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.5.tar.gz
Algorithm Hash digest
SHA256 3306f74bd5a57ada24975e37dc689a576a9c423a4e2950bc315d8eb8b0e55ff2
MD5 eeb7d5f637091b619ecfd9c8574495aa
BLAKE2b-256 01e4a12e728064cef484bd183fff339038aea2dfee80148dfe8c386f1711558b

See more details on using hashes here.

Provenance

The following attestation bundles were made for chembayes-0.1.5.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.5-py3-none-any.whl.

File metadata

  • Download URL: chembayes-0.1.5-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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 32452916f110775a06fcc90664c5afe6248dbe94847a134561085eb083ff863a
MD5 198a0ad9ae6d888026ef50ec0ffacea1
BLAKE2b-256 faa1a33add55742eb29507d677b763448f0a09bfe2e95758450d9a102462bad1

See more details on using hashes here.

Provenance

The following attestation bundles were made for chembayes-0.1.5-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