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 warn_perturbation_caused_no_change #250

Conversation

p-wojciechowski
Copy link
Contributor

Description

The previous implementation of warn_perturbation_caused_no_change raises a warning if any element of the perturbed input differs from the original input. This behaviour contradicts the function name. Additionally, comparing floats with the == operator can be problematic (false negatives) due to error accumulation during float operations.

After this fix, warnings about no change in perturbation won't be raised if there has actually been a change in input. Moreover, the condition for raising the warning handles floats well by using np.allclose.

Implemented changes

  • Fix condition when warining is raised.
  • Fix docstring.

@codecov-commenter
Copy link

Codecov Report

Merging #250 (5b23363) into main (7633c3c) will not change coverage.
The diff coverage is 100.00%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@           Coverage Diff           @@
##             main     #250   +/-   ##
=======================================
  Coverage   92.86%   92.86%           
=======================================
  Files          60       60           
  Lines        3196     3196           
=======================================
  Hits         2968     2968           
  Misses        228      228           
Impacted Files Coverage Δ
quantus/helpers/warn.py 74.46% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Member

@annahedstroem annahedstroem left a comment

Choose a reason for hiding this comment

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

Super, thank you so much for these changes @p-wojciechowski

@annahedstroem annahedstroem merged commit d6368f9 into understandable-machine-intelligence-lab:main Apr 12, 2023
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

Successfully merging this pull request may close these issues.

None yet

3 participants