marcotcr / anchor

Code for "High-Precision Model-Agnostic Explanations" paper

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Calculate Precision and Coverage for custom Anchors

EmanueleLM opened this issue · comments

Let's say that I want to calculate Precision and Coverage of an Anchors that has not been returned by Anchors.
Is there an easy way to accomplish this with the current APIs?

Thank you,
Emanuele

Take a look at this for an example of computing coverage on a dataset, although that function is evaluating multiple anchors at once and is assuming that anchors are not using ranges (i.e. it's only checking for equality in each feature). Coverage of a single anchor is simply what's inside of the loop.

See an example of computing precision here. Again, this is for multiple anchors, but it should be easy to change it to a single anchor. explanation_preds is simply what the anchor predicts.

In sum, it's not easy to do it with the current API, but should be quite easy to change those functions in order to accomplish what you want.