How can I use a permutation-based importance feature using captum as an example
https://scikit-learn.org/stable/modules/permutation_importance.html
How can I use a permutation-based importance feature using captum as an example
https://scikit-learn.org/stable/modules/permutation_importance.html
Yes, You can use captum.attr.FeaturePermutation
@Narine Thanks for your reply. I did see we can use it, however, I was not able to understand the implementation. For example, if we look at the document Captum · Model Interpretability for PyTorch I do not see how we can pass the targets. I am making a comparison between sklearn.inspection.permutation_importance — scikit-learn 0.24.2 documentation. How do we pass the scoring criteria? If you have any working example that you can share will be great
@sushmit_roy, if you want to do something similar to scikitlearn, you can leave target=None and set forward_func as a scoring function.
forward_func can be something like
def my_forward_func(inputs, labels):
return score(model(input), labels) # here score should be returned in form of a scalar tensor.
labels can be passed as additional_forward_args to the attribute method. Let me know if it works for you.