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

Uploaded Python 3

File details

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

File metadata

  • Download URL: chembayes-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 f6015f0e29ce9ac87687bdb2b8ee8278e3d1affdc6a93486a2406803a5ab8e95
MD5 17ec00eb4993e3a9158df5c2ebb21ab8
BLAKE2b-256 99a778b968a0b98fc47509e28966d3f721965c34670c3569062a925c881aec25

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: chembayes-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f79ba536fff3b70bb4a3c0fa2a1974c383ff7434dc24fededad1c36b04491bc8
MD5 e340a0056a455907c5fe802a0d1bb04c
BLAKE2b-256 19c9c2f974ef78006b60dd0cd49d641f78635f3bd89c9174cdc5f79d87fe15a9

See more details on using hashes here.

Provenance

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