The code can be run under any environment with Python 3.9 and above.
We use poetry for dependency management, which can be installed following the instructions here.
To build a virtual environment with the required packages, simply run
poetry config virtualenvs.in-project true
poetry installNotes
- On some systems you may need to set the environment variable
PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyringto avoid keyring-based errors. - The first line tells poetry to create the virtual environment in the project directory, which allows VS Code to find the virtual environment.
- If you are using caches from other machines, if you see errors like "dbm.error: db type is dbm.gnu, but the module is not available", you can probably solve the issue by following instructions from StackOverflow:
sudo apt-get install libgdbm-dev python3-gdbm- If you are using
condaor some other Python version management, you can inspect the output ofdpkg -L python3-gdbmand copy thelib-dynload/_gdbm.cpython-*-x86_64-linux-gnu.sofile to the correspondinglib/directory associated to the python you are using.
To open a Jupyter notebook, run
poetry run jupyter labIf this doesn't work (e.g. you have multiple Jupyter kernels already installed on your system), you may need to make a new kernel for this project:
poetry run python -m ipykernel install --user --name=gbmiYou can run
poetry run python notebooks/max_of_4_all_models.pyto produce the data, and the plots can be seen with
poetry run python notebooks/max_of_4.pyThere are also corresponding .ipynb files for each of these.
See also .github/workflows/ci.yml.
You can delete notebooks/.cache to regenerate all the proofs and analyses from scratch rather than loading them from cache.