optimeo
OPTIMEO – Bayesian Optimization Web App for Process Tuning, Modeling, and Orchestration
About this package
OPTIMEO is a package doubled by a web application that helps you optimize your experimental process by generating a Design of Experiment (DoE), generating new experiments using Bayesian Optimization, and analyzing the results of your experiments using Machine Learning models.
This package was developed within the frame of an academic research project, MOFSONG, funded by the French National Research Agency (N° ANR-24-CE08-7639). See the related paper reference in How to cite.
Installation
Installing the package
Installing the package and its dependencies should take up about 1.3 GB on your hard disk, the main "heavy" dependencies being botorch
, scikit_learn
, plotly
, scipy
, pandas
and streamlit
.
It should be easy enough with pip
:
git clone https://github.com/colinbousige/OPTIMEO.git
cd OPTIMEO
# Otional: create a virtual environment
python -m venv venv
source venv/bin/activate # on Linux or MacOS
# Then, install OPTIMEO as a package:
pip install .
If you did pip install .
, you can upgrade to new a version or uninstall with:
# upgrade the optimeo package
cd OPTIMEO
pip install --upgrade .
# uninstall the optimeo package
pip uninstall optimeo
Using the web app
You can use the app directly on its Streamlit.io web page, but it might be a bit slow if you have a lot of data to process.
If you'd rather run this app on your local machine (which will most probably make it faster than running it on streamlit.io), you can do so by running the following command in your terminal:
git clone https://github.com/colinbousige/OPTIMEO.git
cd OPTIMEO
# Otional: create a virtual environment
python -m venv venv
source venv/bin/activate # on Linux or MacOS
# Then, install the required packages:
pip install -r requirements.txt # to install the required packages
Finally, you can run the app by running the following command in your terminal:
streamlit run Home.py
- You can also modify the path to the
OPTIMEO
folder inOPTIMEO/bin/optimeo
. Then, doing the following will add theoptimeo
command to yourPATH
:
git clone https://github.com/colinbousige/OPTIMEO.git
cd OPTIMEO
pip install . # to install OPTIMEO as a package
chmod +x bin/optimeo
ln -s $(pwd)/bin/optimeo /usr/local/bin/optimeo # or any folder in your PATH
So now, you just have to run optimeo
in your terminal to run the app.
Usage
With the web app
You can use the app directly on its Streamlit.io web page, or run it locally (see Installation).
Choose the page you want to use in the sidebar, and follow the instructions. Hover the mouse on the question marks to get more information about the parameters.
1. Design of Experiment:
Generate a Design of Experiment (DoE) for the optimization of your process. Depending on the number of factors and levels, you can choose between different types of DoE, such as Sobol sequence, Full Factorial, Fractional Factorial, or Definitive Screening Design.
2. New experiments using Bayesian Optimization:
From a previous set of experiments and their results, generate a new set of experiments to optimize your process. You can use up to 10 outcomes, of which 2 can be objectives (i.e. outcomes that you want to minimize or maximize) and the outcomes that are not objectives can be constrained.
3. Data analysis and modeling:
Analyze the results of your experiments and model the response of your process.
With the Python package
You can also use the app as a Python package (see Installation). You can import the different modules of the app and use them in your own code. Here is an example of how to use the app as a package:
For Design of Experiment
A more detailed example is given in the notebook.
from optimeo.doe import *
parameters = [
{'name': 'Temperature', 'type': 'integer', 'values': [20, 40]},
{'name': 'Pressure', 'type': 'float', 'values': [1, 2, 3]},
{'name': 'Catalyst', 'type': 'categorical', 'values': ['A', 'B', 'C']}
]
doe = DesignOfExperiments(
type='Sobol sequence',
parameters=parameters,
Nexp=8
)
doe
For Bayesian Optimization
A more detailed example is given in the notebook.
from optimeo.bo import *
features, outcomes = read_experimental_data('experimental_data.csv', out_pos=[-1])
bo = BOExperiment(
features=features,
outcomes=outcomes,
N = 2, # number of new points to generate
maximize=True, # we want to maximize the response
fixed_features=None,
feature_constraints=None,
optim = 'bo'
)
bo.suggest_next_trials()
For Data Analysis
A more detailed example is given in the notebook.
from optimeo.analysis import *
data = pd.read_csv('dataML.csv')
factors = data.columns[:-1].tolist()
response = data.columns[-1]
analysis = DataAnalysis(data, factors, response)
analysis.model_type = "ElasticNetCV"
MLmodel = analysis.compute_ML_model()
figs = analysis.plot_ML_model()
for fig in figs:
fig.show()
Support
This app was made by Colin Bousige. Contact me for support or to signal a bug, or leave a message on the GitHub page of the app.
How to cite
The source can be found on Github, please consider citing it as:
@software{Bousige_optimeo,
author = {Bousige, Colin},
title = {{OPTIMEO}},
url = {https://github.com/colinbousige/optimeo},
doi = {10.5281/zenodo.15308437}
}
Acknowledgements
This work was supported by the French National Research Agency (N° ANR-24-CE08-7639).
Also, this work was made possible thanks to the following open-source projects:
License
This project is licensed under the MIT License - see the LICENSE file for details
1# write the proper __init__.py file 2# This is the __init__.py file for the OPTIMA package. 3# It is used to mark the directory as a Python package. 4 5# import the necessary modules 6# from . import analysis 7# from . import bo 8# from . import doe 9 10""" 11# OPTIMEO – Bayesian Optimization Web App for Process Tuning, Modeling, and Orchestration 12 13[](https://github.com/colinbousige/OPTIMEO) 14[](https://doi.org/10.5281/zenodo.15308437) 15[](https://joss.theoj.org/papers/5df5fbe4e131d230b13fb3c98db545d8) 16[](https://colinbousige.github.io/OPTIMEO/optimeo.html) 17 18 19--- 20 21## About this package 22 23[OPTIMEO](https://optimeo.streamlit.app/) is a package doubled by a web application that helps you optimize your experimental process by generating a Design of Experiment (DoE), generating new experiments using Bayesian Optimization, and analyzing the results of your experiments using Machine Learning models. 24 25This package was developed within the frame of an academic research project, MOFSONG, funded by the French National Research Agency (N° ANR-24-CE08-7639). See the related paper reference in [How to cite](#how-to-cite). 26 27--- 28 29## Installation 30 31### Installing the package 32 33Installing the package and its dependencies should take up about 1.3 GB on your hard disk, the main "heavy" dependencies being `botorch`, `scikit_learn`, `plotly`, `scipy`, `pandas` and `streamlit`. 34 35It should be easy enough with `pip`: 36 37```bash 38git clone https://github.com/colinbousige/OPTIMEO.git 39cd OPTIMEO 40# Otional: create a virtual environment 41python -m venv venv 42source venv/bin/activate # on Linux or MacOS 43# Then, install OPTIMEO as a package: 44pip install . 45``` 46 47If you did `pip install .`, you can upgrade to new a version or uninstall with: 48 49```bash 50# upgrade the optimeo package 51cd OPTIMEO 52pip install --upgrade . 53# uninstall the optimeo package 54pip uninstall optimeo 55``` 56 57### Using the web app 58 59- You can use the app directly on its [Streamlit.io web page](https://optimeo.streamlit.app/), but it might be a bit slow if you have a lot of data to process. 60 61- If you'd rather run this app on your local machine (which will most probably make it faster than running it on streamlit.io), you can do so by running the following command in your terminal: 62 63```bash 64git clone https://github.com/colinbousige/OPTIMEO.git 65cd OPTIMEO 66# Otional: create a virtual environment 67python -m venv venv 68source venv/bin/activate # on Linux or MacOS 69# Then, install the required packages: 70pip install -r requirements.txt # to install the required packages 71``` 72 73Finally, you can run the app by running the following command in your terminal: 74 75```bash 76streamlit run Home.py 77``` 78 79- You can also modify the path to the `OPTIMEO` folder in `OPTIMEO/bin/optimeo`. Then, doing the following will add the `optimeo` command to your `PATH`: 80 81```bash 82git clone https://github.com/colinbousige/OPTIMEO.git 83cd OPTIMEO 84pip install . # to install OPTIMEO as a package 85chmod +x bin/optimeo 86ln -s $(pwd)/bin/optimeo /usr/local/bin/optimeo # or any folder in your PATH 87``` 88 89So now, you just have to run `optimeo` in your terminal to run the app. 90 91--- 92 93## Usage 94 95### With the web app 96 97You can use the app directly on its [Streamlit.io web page](https://optimeo.streamlit.app/), or run it locally (see [Installation](#installation)). 98 99Choose the page you want to use in the sidebar, and follow the instructions. Hover the mouse on the question marks to get more information about the parameters. 100 101**1. Design of Experiment:** 102Generate a Design of Experiment (DoE) for the optimization of your process. Depending on the number of factors and levels, you can choose between different types of DoE, such as Sobol sequence, Full Factorial, Fractional Factorial, or Definitive Screening Design. 103 104**2. New experiments using Bayesian Optimization:** 105From a previous set of experiments and their results, generate a new set of experiments to optimize your process. You can use up to 10 outcomes, of which 2 can be objectives (i.e. outcomes that you want to minimize or maximize) and the outcomes that are not objectives can be constrained. 106 107**3. Data analysis and modeling:** 108Analyze the results of your experiments and model the response of your process. 109 110### With the Python package 111 112You can also use the app as a Python package (see [Installation](#installation)). You can import the different modules of the app and use them in your own code. Here is an example of how to use the app as a package: 113 114#### For Design of Experiment 115 116A more detailed example is given in [the notebook](https://colab.research.google.com/github/colinbousige/OPTIMEO/blob/main/notebooks/doe.ipynb). 117 118```python 119from optimeo.doe import * 120parameters = [ 121 {'name': 'Temperature', 'type': 'integer', 'values': [20, 40]}, 122 {'name': 'Pressure', 'type': 'float', 'values': [1, 2, 3]}, 123 {'name': 'Catalyst', 'type': 'categorical', 'values': ['A', 'B', 'C']} 124] 125doe = DesignOfExperiments( 126 type='Sobol sequence', 127 parameters=parameters, 128 Nexp=8 129) 130doe 131``` 132 133#### For Bayesian Optimization 134 135A more detailed example is given in [the notebook](https://colab.research.google.com/github/colinbousige/OPTIMEO/blob/main/notebooks/bo.ipynb). 136 137```python 138from optimeo.bo import * 139 140features, outcomes = read_experimental_data('experimental_data.csv', out_pos=[-1]) 141bo = BOExperiment( 142 features=features, 143 outcomes=outcomes, 144 N = 2, # number of new points to generate 145 maximize=True, # we want to maximize the response 146 fixed_features=None, 147 feature_constraints=None, 148 optim = 'bo' 149) 150bo.suggest_next_trials() 151``` 152 153#### For Data Analysis 154 155A more detailed example is given in [the notebook](https://colab.research.google.com/github/colinbousige/OPTIMEO/blob/main/notebooks/MLanalysis.ipynb). 156 157```python 158from optimeo.analysis import * 159 160data = pd.read_csv('dataML.csv') 161factors = data.columns[:-1].tolist() 162response = data.columns[-1] 163analysis = DataAnalysis(data, factors, response) 164analysis.model_type = "ElasticNetCV" 165MLmodel = analysis.compute_ML_model() 166figs = analysis.plot_ML_model() 167for fig in figs: 168 fig.show() 169``` 170 171 172 173--- 174 175## Support 176 177This app was made by [Colin Bousige](mailto:colin.bousige@cnrs.fr). Contact me for support or to signal a bug, or leave a message on the [GitHub page of the app](https://github.com/colinbousige/OPTIMEO). 178 179--- 180 181## How to cite 182 183The source can be found [on Github](https://github.com/colinbousige/optimeo), please consider citing it as: 184 185```bibtex 186@software{Bousige_optimeo, 187 author = {Bousige, Colin}, 188 title = {{OPTIMEO}}, 189 url = {https://github.com/colinbousige/optimeo}, 190 doi = {10.5281/zenodo.15308437} 191} 192``` 193 194--- 195 196## Acknowledgements 197 198This work was supported by the French National Research Agency (N° ANR-24-CE08-7639). 199Also, this work was made possible thanks to the following open-source projects: 200 201- [ax](https://ax.dev/) 202- [BoTorch](https://botorch.org/) 203- [scikit-learn](https://scikit-learn.org/stable/) 204- [pyDOE3](https://github.com/relf/pyDOE3) 205- [dexpy](https://statease.github.io/dexpy/) 206- [doepy](https://doepy.readthedocs.io/en/latest/) 207- [definitive-screening-design](https://pypi.org/project/definitive-screening-design/) 208 209--- 210 211## License 212 213[](https://opensource.org/licenses/MIT) 214 215This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details 216 217 218 219"""