Skip to main content

High throughput parameter extraction and experimental design with Bayesian optimization

Project description

BOAR : Bayesian Optimization for Automated Research

Authors

Vincent M. Le Corre
Larry Lüer

Institution

Institute Materials for Electronics and Energy Technology (i-MEET)
University of Erlangen-Nuremberg (FAU)
Erlangen, Germany

Description

This repository contains the code to run the BOAR. BOAR is a Bayesian optimization procedure that can be use for two objectives:

  1. to optimize the parameters of a simulation to fit experimental data.
  2. to optimize the processing conditions in a self-driving experimental set-up.

BOAR has two main optimizer, one based on scikit-learn which uses the skopt.optimizer and one based on the BoTorch and Ax packages.

Repository Folder Structure

.
├── Main                             # Main directory, place Notebooks here to run them
    ├── boar                         # Main directory for the BOAR codes
        ├── core                     # Directory with the multi-objective optimization codes
        ├── agents                   # Directory with the different experimental agents
        ├── dynamic_utils            # Directory with the different utility functions to solve rate equations
        ├── SIMsalabim_utils         # Directory with the different utility functions to run SIMsalabim, the drift-diffusion simulator
    ├── Notebooks                    # Contains clean versions of the Notebooks, Notebooks need to be moved to the main directory to be used         
    ├── Example_Data                 # Contains some example data for the notebooks
    ├── SIMsalabim                   # Contains the codes to run the drift-diffusion simulations using SIMsalabim
    ├── test                         # Contains the codes for testing BOAR
└── README.md

Installation

With pip

To install BOAR with pip you have two options:

  1. Install BOAR using the PyPI repository
    pip install boar-pv
  1. Install BOAR using the GitHub repository First, you need to clone the repository and install the requirements. The requirements can be installed with the following command:
    pip install -r requirements.txt

Similarly to the conda installation, if you plan on using the BoTorch/Ax optimizer you need to use the requirements_torch_CPU.txt file or install pytorch with the correct version for your system with the requirements.txt file.

With conda

To install the BOAR, you need to clone the repository and install the requirements. The requirements can be installed with the following command:

conda create -n boar 
conda activate boar
conda install --file requirements.txt

if you want you can also clone your base environment by replacing the first line with:

conda create -n boar --clone base

If you plan on using only the scikit-learn optimizer, you can remove use the ''requirements.txt'' file, however if you plan on using the BoTorch/Ax optimizer, you have two options:

  1. If you only want to use the CPU just install the requirements_torch_CPU.txt file:
  2. If you also want to use the GPU and use CUDA you need to refer to the pytorch website to install the correct version of pytorch for your system. First start by intalling the''requirements.txt'' file as described previously then go to the 'Get Started' section https://pytorch.org/get-started/locally/ and select the correct option for your system. You should have to run a command similar to the following one:
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117

Additional necessary for BOAR with BoTorch/Ax

If you plan on using only the scikit-learn optimizer, you can remove use the ''requirements.txt'' file, however if you plan on using the Ax & BoTorch optimizer, you have two options:

  1. If you only want to use the CPU just install the requirements_torch_CPU.txt file as described previously.
  2. If you also want to use the GPU and use CUDA you need to refer to the pytorch website to install the correct version of pytorch for your system. First start by intalling the''requirements.txt'' file as described previously then go to the 'Get Started' section https://pytorch.org/get-started/locally/ and select the correct option for your system. You should have to run a command similar to the following one:
    pip install ax-platform
    pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117

Additional necessary installs for the agents

Drift-diffusion agent

The drift-diffusion agent uses the SIMsalabim package to run the drift-diffusion simulations. If you plan on using the drift-diffusion agent, you need to install SIMsalabim. Note that the drift-diffusion agent can only be used on Linux to run the simulations in parallel and it has not been tested on Windows. However, all the other agents and functionalities of the BOAR can be used on Windows.

SIMsalabim

All the details to install SIMsalabim are detailed in the GitHub repository. To make sure that you are running the latest version of SIMsalabim, check regularly the repository.
Note that we include SIMsalabim in this repository as a submodule, however, you are free to use a different verion.
If you use SIMsalabim, please follow the instruction on the GitHub repository to cite the package.

Parallel simulations

On Linux, you have the option to run the simulations in parrallel. Sadly, not on windows (yet). To be able to run simulations in parrallel efficiently and with any threading or multiprocessing from python we use the parallel from the GNU prallel project. To install on linux run:

sudo apt update
sudo apt install parallel

You can also use Anaconda:

conda install -c conda-forge parallel

To test is the installation worked by using by running the following command in the terminal:

parallel --help

It is also possible to use the parmap package to run the simualtions in parallel. To switch, use the run_multiprocess_simu instead of run_parallel_simu in the RunSimulation function in /VLC_units/Simulation/RunSim.py folder. However, this does not work on Ubuntu version 22.04 but seems to work on older versions.

Disclaimer

This repository is still under development. If you find any bugs or have any questions, please contact us.

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

boar_pv-1.0.7.tar.gz (123.9 kB view details)

Uploaded Source

Built Distribution

boar_pv-1.0.7-py3-none-any.whl (140.2 kB view details)

Uploaded Python 3

File details

Details for the file boar_pv-1.0.7.tar.gz.

File metadata

  • Download URL: boar_pv-1.0.7.tar.gz
  • Upload date:
  • Size: 123.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for boar_pv-1.0.7.tar.gz
Algorithm Hash digest
SHA256 ed548222c6e670d46f42fc7ba83bb2d7e56d66555133cb31e4c5de1ffda7519c
MD5 326d823e5387aaf3b15d7a6354fbe598
BLAKE2b-256 aa9a53fde991595a2df2de50b5e48f2af01b5b9c79b26c075fcbb6e9ba84a227

See more details on using hashes here.

File details

Details for the file boar_pv-1.0.7-py3-none-any.whl.

File metadata

  • Download URL: boar_pv-1.0.7-py3-none-any.whl
  • Upload date:
  • Size: 140.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for boar_pv-1.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 a1f80954367fceb51d1c4d75b386644968fcd74858f03cc96db782551d05dadd
MD5 8463a62afe77e6435d37dd088754c948
BLAKE2b-256 21828b22c423295af8ebcea8f1f96ba343c39059b8f65a2e72ed5a30dd54c84c

See more details on using hashes here.

Supported by

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