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

Adding compatibility check in GeoDA for neural network-based classifiers #2514

Open
wants to merge 1 commit into
base: dev_1.20.0
Choose a base branch
from

Conversation

VishalGawade1
Copy link

Description

This update addresses the compatibility issue between GeoDA and Scikit-learn's RandomForestClassifier. I added a check in the GeoDA constructor to ensure that it only runs with classifiers that include input_shape and channels_first attributes. When an incompatible model, like RandomForestClassifier, is used, the code now raises a ValueError.

Fixes #2493

Type of change

Please check all relevant options.

  • Improvement (non-breaking)
  • Bug fix (non-breaking)
  • New feature (non-breaking)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Testing

I added a unit test (test_geoda_incompatibility.py) that verifies the compatibility check by raising a ValueError when GeoDA is applied to a RandomForestClassifier. This test passed successfully.

Test Configuration:

  • OS: Windows 11
  • Python version: 3.12
  • ART version or commit number: 1.18.1
  • Scikit-learn version: 1.0.2

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • My changes have been tested using both CPU and GPU devices

@beat-buesser beat-buesser changed the base branch from main to dev_1.19.0 November 18, 2024 12:30
Copy link

codecov bot commented Nov 18, 2024

Codecov Report

Attention: Patch coverage is 33.33333% with 2 lines in your changes missing coverage. Please review.

Project coverage is 49.04%. Comparing base (6c57e03) to head (6478b37).
Report is 48 commits behind head on dev_1.19.0.

Files with missing lines Patch % Lines
...attacks/evasion/geometric_decision_based_attack.py 33.33% 1 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff               @@
##           dev_1.19.0    #2514      +/-   ##
==============================================
- Coverage       53.27%   49.04%   -4.23%     
==============================================
  Files             666      666              
  Lines           61858    61558     -300     
  Branches        10516    10260     -256     
==============================================
- Hits            32956    30194    -2762     
- Misses          27205    29704    +2499     
+ Partials         1697     1660      -37     
Files with missing lines Coverage Δ
...attacks/evasion/geometric_decision_based_attack.py 14.56% <33.33%> (-76.70%) ⬇️

... and 279 files with indirect coverage changes

@beat-buesser
Copy link
Collaborator

Hi @VishalGawade1 Thank you very much for your pull request. Could you please rebase your branch on top of the most recent version of branch dev_1.19.0?

@beat-buesser beat-buesser self-assigned this Nov 18, 2024
@VishalGawade1
Copy link
Author

Hi @beat-buesser,
I have done the change, Please have a look

@beat-buesser beat-buesser self-requested a review December 3, 2024 16:41
@beat-buesser beat-buesser added the improvement Improve implementation label Jan 17, 2025
@beat-buesser beat-buesser added this to the ART 1.20.0 milestone Jan 17, 2025
@beat-buesser beat-buesser changed the base branch from dev_1.19.0 to dev_1.20.0 January 17, 2025 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improve implementation
Projects
Status: No status
2 participants