Closed Himanshu-1988 closed 1 year ago
@Himanshu-1988 I've added syntax highlighting to your post to help debug easier :)
It would be good to know more information about the types, e.g. specifically the data_input
of the get_similarity
function and also further parameters such as shape
. To work with the method it's expected that data_input
be an np.ndarray
with the leading dimension reserved for batch (i.e. the predictor
should be able to operate on data with arbitrary batch size N
just like any ML model).
That being said, gradient based counterfactual methods such as this are not well suited for non-gradient-based ML models/functions because they implicitly assume that the output of the model/function is differentiable wrt to the input which it isn't in your case (because there's custom logic with if/else
), so I wouldn't expect this to give good results. Instead, I would recommend looking at CFRL which is specifically designed to work on non-differentiable models/functions.
Thanks for your response.
shape : its a tuple of (1,25) data_input : numpy.ndarray with shape (1, 25)
From your response its clear to me that I can build a system that can generate counterfactual for non-ml model. I will start exploring CFRL
Thanks
Thanks I am able to generate counterfactual for non ml model using CFRL
Hi, I am working on system in which i want to generate counterfactual ,as of now i have some rules that can map input to output which could be proxy to ml model predict function. I have designed my code using predictor wrapper function as suggested in document and able to train counterfactual proto model, but while generating counterfactual I am getting error.
Out put :
Can you please help me on this