-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Greetings!
I would like to visualize the counterfactuals found by VeriX. In the "VeriX" class, "get_explanation" function, I set the "plot_counterfactual" argument to true. The resulting counterfactuals tend to contain a pixel out of bounds (OOB), with values outside of 0 and 1, e.g. -5, +20. Depending on the image and traversal order set, it also appears that this OOB pixel stays the same for different counterfactuals, with some other pixels varying accordingly between counterfactual examples. This is despite the fact that epsilon is set to 0.05, so the pixel should not vary more than that from its original value.
Reproduction of issue:
- Load the MNIST dataset, as done in mnist.py
- Initialize the VeriX object with the provided model and test image index 112, as below, and set plot_counterfactual=True:
verix = VeriX(dataset="MNIST",
image=x_test[112],
model_path="models/mnist-10x2.onnx")
verix.traversal_order(traverse="heuristic")
verix.get_explanation(epsilon=0.05, plot_counterfactual=True)
This results in ~300 counterfactuals generated, however, (1) all except one contain the same OOB pixel that creates a big contrast in the image, (2) and between them a single pixel varies by epsilon ( (2) as expected). I've attached some examples to show what I mean; note that only counterfactual-at-pixel-685 is different. ZIP attachment:counterfactual-at-pixel-.zip
Is this a VeriX issue? Is it a Marabou issue? I tried to look into the Marabou implementation, but it relies on a C++ function that I can't understand on my own. I see that the bounds are properly set in VeriX for both irrelevant and on the current pixel, so I can't understand why Marabou would return a pixel outside of the input bounds.
I'd also like to note that similar behaviour is seen for multiple images, not just x_test[112]. Setting a sequential traversal order (rather than using the provided heuristic) results in various pixels being OOB for each counterfactual, but the question remains on why they are returned as OOB.