I am trying to implement Java code for Counterfactuals functionality for classification algorithms using Weka API. I am unable to find any API for this algorithm in weka wiki page. Could you please help me with this by providing any info of the API in weka wiki or any reference where it is already implemented or how to implement this using weka. It would be very helpful to continue my work.
Like in the above links to implement this they have given some suggestions and steps to follow. But which functions and classes should i call or use from weka to implement them ?
" The function d for measuring the distance between instance x and counterfactual x’ is the Manhattan distance weighted feature-wise with the inverse median absolute deviation (MAD). "
"To minimize this loss function, any suitable optimization algorithm can be used, e.g. Nelder-Mead. If you have access to the gradients of the machine learning model, you can use gradient-based methods like ADAM"
The recipe for producing the counterfactuals is simple: