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

Send nb_classes to check_and_transform_label_format in inference attacks #1713

Merged

Conversation

abigailgold
Copy link
Collaborator

@abigailgold abigailgold commented May 24, 2022

Description

Send nb_classes to check_and_transform_label_format in inference attacks.

Fixes #1712

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

New test that sends labels as column vector.

Test Configuration:

  • OS: MacOS 12.3
  • Python version 3.7

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

Signed-off-by: abigailt <abigailt@il.ibm.com>
Signed-off-by: abigailt <abigailt@il.ibm.com>
…ship attacks as well)

Signed-off-by: abigailt <abigailt@il.ibm.com>
Signed-off-by: abigailt <abigailt@il.ibm.com>
Signed-off-by: abigailt <abigailt@il.ibm.com>
Signed-off-by: abigailt <abigailt@il.ibm.com>
…ship attacks as well)

Signed-off-by: abigailt <abigailt@il.ibm.com>
Signed-off-by: abigailt <abigailt@il.ibm.com>
… dev_1.11.0_attribute_fixes

# Conflicts:
#	art/attacks/inference/attribute_inference/black_box.py
#	art/attacks/inference/attribute_inference/true_label_baseline.py
Signed-off-by: abigailt <abigailt@il.ibm.com>
@codecov-commenter
Copy link

codecov-commenter commented May 24, 2022

Codecov Report

Merging #1713 (355829d) into dev_1.11.0 (12a1767) will decrease coverage by 3.76%.
The diff coverage is 100.00%.

Impacted file tree graph

@@              Coverage Diff               @@
##           dev_1.11.0    #1713      +/-   ##
==============================================
- Coverage       88.04%   84.27%   -3.77%     
==============================================
  Files             260      260              
  Lines           21442    21448       +6     
  Branches         3809     3809              
==============================================
- Hits            18879    18076     -803     
- Misses           1612     2450     +838     
+ Partials          951      922      -29     
Impacted Files Coverage Δ
.../attacks/inference/attribute_inference/baseline.py 72.58% <100.00%> (+0.91%) ⬆️
...attacks/inference/attribute_inference/black_box.py 81.41% <100.00%> (+0.33%) ⬆️
...ference/attribute_inference/true_label_baseline.py 68.75% <100.00%> (+0.80%) ⬆️
...rence/membership_inference/black_box_rule_based.py 80.00% <100.00%> (ø)
art/attacks/evasion/pe_malware_attack.py 14.74% <0.00%> (-84.34%) ⬇️
...estimators/speech_recognition/tensorflow_lingvo.py 18.27% <0.00%> (-73.10%) ⬇️
...mation/natural_corruptions/zoom_blur/tensorflow.py 32.25% <0.00%> (-61.30%) ⬇️
...g/backdoor_attack_dgm/backdoor_attack_dgm_trail.py 34.88% <0.00%> (-60.47%) ⬇️
...rmation/natural_corruptions/contrast/tensorflow.py 40.00% <0.00%> (-60.00%) ⬇️
...ing/backdoor_attack_dgm/backdoor_attack_dgm_red.py 42.42% <0.00%> (-48.49%) ⬇️
... and 23 more

Signed-off-by: abigailt <abigailt@il.ibm.com>
Comment on lines 129 to 130
if self._values is not None:
self._nb_classes = len(self._values)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need these two lines? Or can we document the definition with len(self._values) in a comment in line 128?

Suggested change
if self._values is not None:
self._nb_classes = len(self._values)

Comment on lines 139 to 140
if self._values is not None:
self._nb_classes = len(self._values)
Copy link
Collaborator

@beat-buesser beat-buesser May 25, 2022

Choose a reason for hiding this comment

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

Do we need these two lines? Or can we document the definition with len(self._values) in a comment in line 138?

Comment on lines 115 to 116
if self._values is not None:
self._nb_classes = len(self._values)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need these two lines? Or can we document the definition with len(self._values) in a comment in line 114?

Copy link
Collaborator

@beat-buesser beat-buesser left a comment

Choose a reason for hiding this comment

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

Hi @abigailgold Thank you very much for your pull request. I think the updates look good. I have a question about 2 lines in each class if they are required. What do you think?

Signed-off-by: abigailt <abigailt@il.ibm.com>
@beat-buesser beat-buesser self-assigned this May 25, 2022
@beat-buesser beat-buesser added bug Something isn't working improvement Improve implementation labels May 25, 2022
@beat-buesser beat-buesser added this to Pull request open in ART 1.11.0 via automation May 25, 2022
@beat-buesser beat-buesser added this to the ART 1.11.0 milestone May 25, 2022
Copy link
Collaborator

@beat-buesser beat-buesser left a comment

Choose a reason for hiding this comment

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

Hi @abigailgold Thank you very much. The code looks good to me!

@beat-buesser beat-buesser merged commit 313f373 into Trusted-AI:dev_1.11.0 Jun 20, 2022
ART 1.11.0 automation moved this from Pull request open to Pull request done Jun 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working improvement Improve implementation
Projects
No open projects
ART 1.11.0
  
Pull request done
Development

Successfully merging this pull request may close these issues.

Attribute attacks sometimes throw exception, depending on shape of labels
3 participants