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

fix: TensorFlow explainers have the same signature as the rest #415

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

asendotsinski
Copy link

Right now the TensorFlow gradient explainers do not implement the _generate_counterfactuals method from the BaseExplainer class. This means that:
1) You cannot instantiate object of class
DiceTensorFlow(1/2) without replacing the __class__
of another method, because it is not a valid child
of ExplainerBase.
2) By overriding the parent generate_counterfactuals
method, the two classes bypass any validation steps
that would normally be carried out by the base class
(e.g. checking that the number of CF queries is non-negative).

I believe this to be in error, is it on purpose?

@asendotsinski asendotsinski force-pushed the tf-explainer-signatures branch 3 times, most recently from 010f2bb to 6a077eb Compare October 29, 2023 09:53
@asendotsinski asendotsinski marked this pull request as ready for review October 29, 2023 09:54
@codecov-commenter
Copy link

codecov-commenter commented Oct 30, 2023

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Files Coverage Δ
dice_ml/explainer_interfaces/dice_tensorflow2.py 85.01% <100.00%> (-0.05%) ⬇️
dice_ml/explainer_interfaces/dice_tensorflow1.py 0.00% <0.00%> (ø)

📢 Thoughts on this report? Let us know!.

Copy link
Collaborator

@gaugup gaugup left a comment

Choose a reason for hiding this comment

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

@asendotsinski could you please look at the linting failures in your PR?

Right now the TensorFlow gradient explainers do not implement
the `_generate_counterfactuals` method from the `BaseExplainer`
class. This means that:
	1) You cannot instantiate object of class
	`DiceTensorFlow(1/2)` without replacing the `__class__`
	of another method, because it is not a valid child
	of `ExplainerBase`.
	2) By overriding the parent `generate_counterfactuals`
	method, the two classes bypass any validation steps
	that would normally be carried out by the base class
	(e.g. checking that the number of CF queries is non-negative).

Signed-off-by: Asen Dotsinski <[email protected]>
@asendotsinski
Copy link
Author

@gaugup It should be good now, I checked the linter locally.

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

Successfully merging this pull request may close these issues.

3 participants