head
Supporting code for the "Autonomous retrosynthesis of gold nanoparticles via spectral shape matching" paper. DOI : 10.1039/D2DD00025C
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (11.7%) to scientific vocabulary
Keywords
Repository
Supporting code for the "Autonomous retrosynthesis of gold nanoparticles via spectral shape matching" paper. DOI : 10.1039/D2DD00025C
Basic Info
Statistics
- Stars: 8
- Watchers: 0
- Forks: 2
- Open Issues: 1
- Releases: 0
Topics
Metadata Files
README.md
Bayesian Optimization branch for HEAD
This branch contains code for the Bayesian Optimization part.
We recommend installing the package by following the instructions below.
In a Linux command shell with Anaconda installation of Python,
bash
conda env create -f environment.yml
Now install the packages required to compute the Amplitude-Phase distance using :
bash
pip install git+https://github.com/kiranvad/Amplitude-Phase-Distance.git
and then :
bash
pip install git+https://github.com/kiranvad/warping.git
Install the head package using the following :
bash
git clone -b BO https://github.com/pozzo-research-group/HEAD.git
cd HEAD
pip install -e .
Additionally, to run case studies for the paper, install the geomstats package using the following:
bash
git clone -b shapematching_paper https://github.com/kiranvad/geomstats.git
cd geomstats
pip install .
Example using the Gaussian function simulator can be performed as follows:
Import the required function using the below code snippet:
python
from head import opentrons
import pandas as pd
import numpy as np
from scipy.spatial import distance
import warnings
warnings.filterwarnings("ignore")
We need a simulator to mimic a robotic experiment. We achieve this using the following: ```python class Simulator: def init(self): self.domain = np.linspace(-5,5,num=100)
def generate(self, mu, sig):
scale = 1/(np.sqrt(2*np.pi)*sig)
return scale*np.exp(-np.power(self.domain - mu, 2.) / (2 * np.power(sig, 2.)))
def process_batch(self, Cb, fname):
out = []
for c in Cb:
out.append(self.generate(*c))
out = np.asarray(out)
df = pd.DataFrame(out.T, index=self.domain)
df.to_excel(fname, engine='openpyxl')
return
def make_target(self, ct):
return self.domain, self.generate(*ct)
The simulator simply returns a Gaussian distribution function given `mu` and `sigma` values. We use this to specify a target distribution:
python
sim = Simulator()
target = np.array([-2,0.5])
xt, yt = sim.make_target(target)
```
Set up your design space using the lower and upper limits
python
Cmu = [-5,5]
Csig = [0.1,3.5]
bounds = [Cmu, Csig]
Define a distance metric function ```python from apdist import AmplitudePhaseDistance
def APdist(f1,f2): da, dp = AmplitudePhaseDistance(f1,f2,xt)
return -(da+dp)
```
Initiate the optimizer using the following: ```python optim = opentrons.Optimizer(xt, yt, bounds, savedir = '../data', batchsize=4, metric = metricfunction )
```
Perform a random iteration ```python
random iteration
optim.save() C0 = np.load('../data/0/newx.npy') sim.processbatch(C0, '../data/opentrons/0.xlsx') optim.update('../data/0.xlsx') optim.save() optim.getcurrentbest() ```
Perform the BO iterations with a specified budget ```python for i in range(1,21): # iteration i selection optim.suggestnext() optim.save() # simulate iteration i newx Ci = np.load('../data/%d/newx.npy'%i) sim.processbatch(Ci, '../data/%d.xlsx'%i) optim.update('../data/%d.xlsx'%i) optim.save() optim.getcurrentbest()
```
Note that when a robotic experiment is involved, each iteration has to be performed with the robot in the loop thus we would perform the for loop one at a time.
In a Jupyter Notebook format, we would do this one iteration at a time, keeping the Kernel active and adding one new cell for each iteration below the previous iteration but performing the same set of operations. A more neater approach for this is in the works.
At any given iteration, the function get_current_best reports what the algorithm thinks is the best match so far.
Owner
- Name: pozzo-research-group
- Login: pozzo-research-group
- Kind: organization
- Repositories: 11
- Profile: https://github.com/pozzo-research-group
Citation (CITATION.cff)
cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Vaddi"
given-names: "Kiran"
orcid: "https://orcid.org/0000-0003-2998-769X"
- family-names: "Thart Chiang"
given-names: "Huat"
orcid: "https://orcid.org/0000-0002-0042-7958"
- family-names: "D. Pozzo"
given-names: "Lilo"
orcid: "https://orcid.org/0000-0001-7104-9061"
title: "Autonomous retrosynthesis of gold nanoparticles via spectral shape matching"
version: 1.0
date-released: 2022-07-19
url: "https://github.com/pozzo-research-group/HEAD/tree/BO"
preferred-citation:
type: article
authors:
- family-names: "Vaddi"
given-names: "Kiran"
orcid: "https://orcid.org/0000-0003-2998-769X"
- family-names: "Thart Chiang"
given-names: "Huat"
orcid: "https://orcid.org/0000-0002-0042-7958"
- family-names: "D. Pozzo"
given-names: "Lilo"
orcid: "https://orcid.org/0000-0001-7104-9061"
doi: "10.1039/d2dd00025c"
journal: "Digital Discovery"
publisher: "Royal Society of Chemistry (RSC)"
title: "Autonomous retrosynthesis of gold nanoparticles via spectral shape matching"
year: 2022
GitHub Events
Total
- Watch event: 2
Last Year
- Watch event: 2
Dependencies
- botorch ==0.8.5
- geomstats ==2.7.0
- matplotlib ==3.7.1
- openpyxl ==3.1.2
- pandas ==2.0.3
- seaborn ==0.12.2
- torchvision ==0.15.2
- botorch *
- matplotlib *
- numpy <=1.20
- openpyxl *
- pandas *
- scikit-learn *
- scipy *