Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible anchor coverage issue #80

Open
danyveve opened this issue Mar 23, 2022 · 0 comments
Open

Possible anchor coverage issue #80

danyveve opened this issue Mar 23, 2022 · 0 comments

Comments

@danyveve
Copy link

Hello Marco,

In the 'Anchor on tabular data.ipynb' example, and also in the SP Anchors example from the anchor-experiments repository, I am not sure if I am misunderstanding this, but I think you may be computing the coverage of an Anchor in a wrong way. You seem to only check for equality in feature values (of course, only for the features included in the Anchor) between the instance that generated the Anchor and the other instances from the dataset.
The specific files and lines I am referring to are the following:

  • 'Anchor on tabular data.ipynb':
    Line fit_anchor = np.where(np.all(dataset.test[:, exp.features()] == dataset.test[idx][exp.features()], axis=1))[0]
  • 'utils.py' from the 'anchor-experiments' repository:
    Line 347, 347:
covered[i] = set(
            np.all(data[:, fs] == d[fs], axis=1).nonzero()[0])

Shouldn't you compute the coverage based on the operator used in the Anchor, similar to what you do in file 'anchor_tabular.py' from the on Lines 254-261?

for i in mapping:
                f, op, v = mapping[i]
                if op == 'eq':
                    data[:, i] = (d_raw_data[:, f] == data_row[f]).astype(int)
                if op == 'leq':
                    data[:, i] = (d_raw_data[:, f] <= v).astype(int)
                if op == 'geq':
                    data[:, i] = (d_raw_data[:, f] > v).astype(int)

Thank you!
-Alexandru

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant