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

Support sklearn models with multiple outputs #2505

Merged
merged 6 commits into from
Dec 17, 2024

Conversation

abigailgold
Copy link
Collaborator

Description

The Classifier nb_classes setter now accepts non-integer values to support cases where the classifier has multiple outputs.
check_and_transform_label_format still only supports integer nb_classes values, but throws a TypeError if a different type is received.

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

Added a test with a multi-output DecisionTreeClassifier

Test Configuration:

OS: MacOS 14.4
Python version: 3.9
ART version or commit number
TensorFlow / Keras / PyTorch / MXNet version

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 self-requested a review October 7, 2024 20:13
@beat-buesser beat-buesser self-assigned this Oct 7, 2024
@beat-buesser beat-buesser added the enhancement New feature or request label Oct 7, 2024
@beat-buesser beat-buesser added this to the ART 1.19.0 milestone Oct 7, 2024
Copy link

codecov bot commented Oct 7, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.

Project coverage is 85.40%. Comparing base (0b4bb68) to head (bd58b1a).
Report is 7 commits behind head on dev_1.19.0.

Files with missing lines Patch % Lines
art/estimators/classification/classifier.py 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff               @@
##           dev_1.19.0    #2505      +/-   ##
==============================================
- Coverage       85.42%   85.40%   -0.02%     
==============================================
  Files             334      334              
  Lines           30998    31000       +2     
  Branches         5298     5299       +1     
==============================================
- Hits            26479    26476       -3     
- Misses           3052     3055       +3     
- Partials         1467     1469       +2     
Files with missing lines Coverage Δ
art/utils.py 79.57% <100.00%> (+0.05%) ⬆️
art/estimators/classification/classifier.py 96.61% <0.00%> (ø)

... and 3 files with indirect coverage changes

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 contribution!

@beat-buesser beat-buesser merged commit cf11263 into Trusted-AI:dev_1.19.0 Dec 17, 2024
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants