DiCE
DiCE copied to clipboard
Generating CF examples for the multi-class classification case using the GD-based method
Hi,
I was wondering if the current implementation of the GD-based method (I mean the loss-based method described in your paper, Mothilal et al. (2020)) can handle the multi-class classification case?
I see in dice_tensorflow2.py, that the "desired_class" parameter can only be 0 or 1.
Many thanks that you take the time to answer the questions.
We are working on supporting multi-class, but the current version on tensorflow supports only binary at the moment.
Thanks for your response.
For a submission, I need to apply your method to a multi-class problem, for which I will cite your work. Unfortunately, my time is limited, and I would appreciate it if you describe how I modify the code so it can be applied for multi-class case (if the change is simple and theoretically fine). I think if I modify the "predict_fn" function in dice_tensorflow2.py, then the method would work without any further changes. Am I correct?
That's correct. you will need to change the predict_fn. But you may find that the rest of the code expects a single-dimensional value as output of classifier---so you may need to change those parts to do "max of the output scores" rather than "is output score more than 0.5/threshold".
Hope this helps. Happy to answer any questions as you go through the code, and would love if you can raise a PR with these changes after your submission.
Many thanks for your help. Sure, I will raise a PR after I applied the changes.
Could you kindly confirm if multi-class classification is supported for "gradient" method with PyTorch/Tensorflow backend now?
yes, it is supported now in the latest release.