This repository is the official implementation of Learning the Finer Things.
To install requirements:
pip install -r requirements.txt
If you wish to run BN or BKB learning from scratch then you will also need to install pygobnilp as well as obtain an academic liscence to Gurobi as this is the optimization suite that the GOBNILP backend uses.
We have included pre-trained BKBs and BNs at the following anonymous Zenodo repository which can be downloaded directly our mounted in the cloud using Google Colab which will be discussed the Evaluation section.
If you wish to run training from scratch, you will need to ensure the above requirements are met, download the pre-processed KEEL datasets and/or TCGA breast cancer dataset from the following anonymous links: Preprocessed KEEL dataset and Preprocessed TCGA breast cancer dataset. Then run the following to scripts:
- Navigate to nips_experiments
- Run the following script to generate the scores for KEEL benchmarks (Optionally, pass a dataset name with --dataset_name=dataset otherwises the script will run through all the datasets):
python3 run_keel_benchmark_scores.py /path/to/datasets /path/to/save/scores
- Upon completion of the KEEL score calculations, run the following script to learn the associated BKBs and BNs for KEEL:
python3 run_keel_benchmark_from_scores.py /path/to/datasets /path/to/save/results /path/to/scores --palim=palim --dataset_name=dataset_name
To run the TCGA learning, first download the data as described above and run:
python3 run_tcga.py /path/to/dataset /path/to/save/results
Evaluation of BKBs and BNs are best done in the supplied Jupyter Notebooks. First, you should download the pre-learned BKBs and BNs hosted on Zenodo. You will then need to unzip these files and follow the instructions in the corresponding notebooks:
We recommend setting up a python virtual environment to run all jupyter notebooks locally.
- Clone this repo and create a virtual environment with python 3.8 or above.
python3.8 -m venv pybkb_venv
. pybkb_venv/bin/activate
- Run the included setup.py with
python3 setup.py install
- Make sure to install pygobnilp with pip or clone the pygobnilp repository.
- Install your virtual enivronment into the jupyter notebook kernels
python3 -m ipykernel install --user --name=pybkb_venv
- Install notebook extensions for ipywidgets with
jupyter nbextension enable --py widgetsnbextension
- Make sure you have downloaded the pre-learned BKBs from Zenodo here and have unzipped these files locally.
- Launch the jupyter with
jupyter notebook
- Open the respective notebook, i.e. KEEL Benchmark Analysis or TCGA Analysis, and follow the notebook's instructions to evaluate BNs and BKBs to your liking.