Code and Data repository for our paper titled Composition of Relational Features with an Application to Explaining Black-Box Predictors.
The paper is under review (status: Revision submitted) at the Machine Learning Journal (MLJ). We will update the link to the paper once the paper is accepted and published officially.
Our repository of CRM here might not be maintained. The current repository is intended to be up-to-date with our newer results and further research extensions. Keep watching!
[Nov 14, 2023] This paper was also presented at the IJCLR 2023: PPT.
[Oct 26, 2023] The paper is now officially published by the Machine Learning Journal.
CRMs are explainable deep neural networks, a neurosymbolic architecture in which each node in a neural network has an associated relational feature. While being independently explainable in nature, CRMs can also be used for generating structured proxy explanations for a black-box predictor.
A CRM consists of CRM-nodes (or CRM-neurons), where each node is associated with a valuation of a relational feature. An illustrative figure is shown below:
Every neuron has an arithmetic part
Let us consider an example problem from the paper to illustrate the workings of a CRM.
The "East-West Challenge" (Michie et al., 1994), participants were supposed to distinguish eastbound trains from westbound ones using properties of the carriages and their loads (the engine’s properties are not used), using pictorial descriptions like these (T1 is eastbound and T2 is westbound):
Our CRM aims to take these features as input, predict the direction of the train, and generate explanations for the prediction.
The first layer of the CRM is composed of primitive features, like
Here, we will assume that predicates like
Then the corresponding feature-function values are:
Given a way to generate the predicate part of the CRM, the arithmetic part is generated using the same way as in a standard neural network using backpropagation, with each neuron (
Given a (relational) data instance representing a train with some cars and their properties, as shown below, a CRM generates structured explanations shown below.
We use Layerwise-Relevance Propagation (LRP) (Bach et al., 2015; Binder et al., 2016) to calculate the most relevant neurons in the penultimate layer of the CRM, just before the final two neuron classification layer. We then find the ancestral graph of this neuron to explain the prediction.
- CRM's core codebase is developed jointly with Devanshu Shah @Devanshu24.
Environment setup: requirements.txt
$ python3 main.py -h
usage: main.py [-h] -f FILE -o OUTPUT -n NUM_EPOCHS [-s SAVED_MODEL] [-e] [-v] [-g]
CRM; Example: python3 main.py -f inp.file -o out.file -n 20 -s saved_model.pt -e -v
optional arguments:
-h, --help show this help message and exit
-f FILE, --file FILE input file
-o OUTPUT, --output OUTPUT
output file
-n NUM_EPOCHS, --num-epochs NUM_EPOCHS
number of epochs
-s SAVED_MODEL, --saved-model SAVED_MODEL
location of saved model
-e, --explain get explanations for predictions
-v, --verbose get verbose outputs
-g, --gpu run model on gpu
For reference, some example commands are in command.hist
.
Caution! Some result or model files might get overwritten. Check the directory structure before running. Honestly, we did not properly care about this aspect. Over time, we will fix this simple thing. Also, our results get saved in the ./data
directory, which is not good. We will work on these :-)
Bibtex:
@article{srinivasan2023composition,
title={Composition of relational features with an application to explaining black-box predictors},
author={Srinivasan, Ashwin and Baskar, A and Dash, Tirtharaj and Shah, Devanshu},
journal={Machine Learning},
pages={1--42},
year={2023},
doi={10.1007/s10994-023-06399-6},
publisher={Springer},
url={https://doi.org/10.1007/s10994-023-06399-6}
}