Let's say we have a general pytorch module. The module has at least one artificial neural network (ANN) as a submodule.
GPEX replaces the ANN submodule with some Gaussian processes. For doing so you will not be involved in details of the algorithm. You only specify the ANN submodule and a few API functions, and GPEX does the rest under the hood.
Documentation is available on gpex.readthedocs.io. You can also refer to the sample notebook (in folder 'Sample_Notebooks/') for a detailed usage example.
This package is not yet pip-installable. To use this package append the path to gpex folder to sys.path
, as done in the sample notebook.
You can find the notebooks in the "PaperResults/" directory. For instance, the notebook for explaining the classifier on cifar10 is located in "PaperResults/Cifar10/demo_explainANN_classifier.ipynb" and the notebook for explaining the attention subcomponent is located in "PaperResults/Cifar10/demo_explainANN_attention.ipynb".
To run the notebooks, you firstly need to run the following python script to that downloads the models and datasets:
python setup_paperresults.py
If you want to download the material for a specific dataset, you can pass in one argument which has to either "cifar10", "mnist", "kather", or "dogswolves". For example:
python setup_paperresults.py cifar10
Sometimes the above script fails to download the models from google drive due to, e.g., the download quota being exceeded. In this case, "after running the above script" you can manually download and place the models in the directories:
-
Downlaod the model in this link and save it as "Material_PaperResults/Models/ExplainClassifier/cifar10.pt"
-
Downlaod the model in this link and save it as "Material_PaperResults/Models/ExplainAttention/cifar10.pt"
-
Downlaod the model in this link and save it as "Material_PaperResults/Models/ExplainClassifier/mnist_classification.pt"
-
Downlaod the model in this link and save it as "Material_PaperResults/Models/ExplainAttention/mnist_attention.pt"