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

Deprecate and rename conflicting argument names #558

Closed
wants to merge 6 commits into from

Conversation

NarineK
Copy link
Contributor

@NarineK NarineK commented Dec 11, 2020

As also mentioned in #549, we had conflicting argument names in the API. In this PR we deprecate and rename those argument names. More specifically:

  1. n_samples in NoiseTunnel is being renamed to nt_samples
  2. n_perturbed_samples in Lime and KernelSHAP are being renamed to n_samples in order to remain consistent with Shapely Values (Sampling)

Copy link
Contributor

@vivekmig vivekmig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks for updating this :) ! I think we might also need to update the generated tests here https://github.com/pytorch/captum/blob/master/tests/attr/helpers/test_config.py with the updated names, but can also leave it for now and update when we deprecate to continue testing the older names, either way works.


@functools.wraps(func)
def wrapper(*args: Any, **kwargs: Any):
if "n_samples" in kwargs:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this condition can also check that nt_samples is not already in kwargs? Otherwise, it wouldn't be possible to pass both for Lime and KernelShap until this is deprecated right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, that's a good point!

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NarineK has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NarineK has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NarineK has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@NarineK merged this pull request in ed558b0.

vivekmig pushed a commit that referenced this pull request Jan 21, 2021
Summary:
As also mentioned in #549, we had conflicting argument names in the API. In this PR we deprecate and rename those argument names. More specifically:
1. `n_samples` in NoiseTunnel is being renamed to `nt_samples`
2. `n_perturbed_samples` in Lime and KernelSHAP are being renamed to `n_samples` in order to remain consistent with Shapely Values (Sampling)

Pull Request resolved: #558

Reviewed By: edward-io

Differential Revision: D25514136

Pulled By: NarineK

fbshipit-source-id: 142c974da2a8430be234fe4ffc79e36faf2bf8d9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants