Digital circuits and neural networks based on acid-base chemistry implemented by robotic fluid handling
This is the codebase and scripts of our paper: Digital circuits and neural networks based on acid-base chemistry implemented by robotic fluid handling.
- Tested on Linux (Debian 9.3)
- Python 3.7
- Uses Python's virtualenv
- All needed Python packages are installable from dataset-gen/requirements.txt & simulations/requirements.txt as explained below.
- Pacakge dependencies are pretty light, hence, installation should be very fast depending on the bandwidth.
- Every generation or simulation script takes around 1-10 mins depending on the resources and the datasize on average desktops.
The code is split into two parts:
- dataset-gen/ contains the scripts that are used to download MNIST dataset, run the model training, binarization of the weights, and the dataset.
- simulations/ contains the echo scripts and the simulation files to simulate the datasets generated from the previous part.
To download the dataset files:
- Navigate to simulations/
- Run
python download_dataset.py
- The script will download and extract the dataset to simulations/simulation/datasets
It it recommended to use the dataset provided through option A, but if you prefer to generate the dataset by yourself:
- Navigate to dataset-gen/
- Create a Python virtual environment using:
virtualenv venv
- Activate the environment:
source venv/bin/activate
- Install the dependencies:
pip install -r requirements.txt
- Finally, to train the model and generate the dataset files, run:
./generate_ds_imgs.sh
- This will generate the needed data under datasets/
To run the simulations:
- Navigate to simulations/
- Create a Python virtual environment using:
virtualenv venv
- Activate the environment:
source venv/bin/activate
- Install the dependencies:
pip install -r requirements
- Set the environment variable:
export PYTHONPATH=$(pwd):$(pwd)/chemcpupy
- Set the variable data_path to the corresponding datasset path.
- Finally, to execute the simulations, run:
./sim_2_class_bin.sh
,./sim_3_class_bin.sh
, orsim_2_class_3bit.sh
to simulate the corresponding experiment from the paper. - The scripts will generate accuracy files in the form of acc_<bin or 3bit>_<number of classe>class_<image size>.txt that contains the accuracy metrics for the given simulations. The expected output should be similar to the results table in the manuscript.
- To clear the generated data, run
./clean.sh
to delete the generated files.
Yann LeCun and Corinna Cortes hold the copyright of MNIST dataset, which is a derivative work from original NIST datasets. MNIST dataset is made available under the terms of the Creative Commons Attribution-Share Alike 3.0 license.
See LICENSE file
If you find our work helpful in your research, please cite our paper:
@article{agiza2023digital,
title={Digital circuits and neural networks based on acid-base chemistry implemented by robotic fluid handling},
author={Agiza, Ahmed A and Oakley, Kady and Rosenstein, Jacob K and Rubenstein, Brenda M and Kim, Eunsuk and Riedel, Marc and Reda, Sherief},
journal={Nature communications},
volume={14},
number={1},
pages={496},
year={2023},
publisher={Nature Publishing Group UK London}
}