/Contrastive-Explanation-Method

Codes for reproducing the contrastive explanation in “Explanations based on the Missing: Towards Contrastive Explanations with Pertinent Negatives”

Primary LanguagePythonApache License 2.0Apache-2.0

Contrastive-Explanation-Method

Codes for reproducing the contrastive explanation in “Explanations based on the Missing: Towards Contrastive Explanations with Pertinent Negatives

To find the pertinent positive (PP) of an instance,

python3 main.py -i 2953 --mode PP --kappa 10 --gamma 100

This would find the PP of image ID 2953 in the test images from the MNIST dataset.

From left to right: the original image and the pertinent positive component. This PP in Image 2953 is sufficient to be classified as 5.

To find the pertinent negative (PN) of an instance,

python3 main.py -i 340 --mode PN --kappa 10 --gamma 100

This would find the PN of image ID 340 in the test images from the MNIST dataset.

From left to right: the original image, the pertinent negative component and the image composed of the original image and PN. If we add PN to Image 340, it would be classified as 5.

The argument kappa (confidence lebel) and gamma (regularization coefficient of autoencoder) are tuning parameters for the optimization setup. Both PP and PN are used to explain the model prediction results. For more details, please refer to the paper.