Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

Conversation

@connortann
Copy link
Collaborator

@connortann connortann commented Jan 28, 2025

Overview

If the passed Explanation object has exactly two classes, assume it is a binary classifier and slice the second class.

Closes #3951
Related: #1460

Discussion

I've labelled this as an "enhancement" as I'm not sure the original behaviour is a bug, although that's debatable.

I'd value a review from @CloseChoice , in particular to get a sense of whether it's a reasonable assumption that an explanation with values of shape [_, _, 2] represents a binary classifier.

Checklist

  • All pre-commit checks pass.
  • Unit tests added (if fixing a bug or adding a new feature)

@connortann connortann added bug Indicates an unexpected problem or unintended behaviour enhancement Indicates new feature requests and removed bug Indicates an unexpected problem or unintended behaviour labels Jan 28, 2025
@connortann connortann changed the title FIX: Handle binary classifier in beeswarm plot ENH: Handle binary classifier in beeswarm plot Jan 28, 2025
@connortann connortann added the visualization Relating to plotting label Jan 28, 2025
@connortann connortann marked this pull request as ready for review January 28, 2025 16:23
@codecov
Copy link

codecov bot commented Jan 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 64.67%. Comparing base (74acc5a) to head (3c7269a).
Report is 8 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3981   +/-   ##
=======================================
  Coverage   64.67%   64.67%           
=======================================
  Files          92       92           
  Lines       12862    12865    +3     
=======================================
+ Hits         8318     8321    +3     
  Misses       4544     4544           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@CloseChoice CloseChoice left a comment

Choose a reason for hiding this comment

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

Nice work. Thanks. LGTM

@CloseChoice
Copy link
Collaborator

CloseChoice commented Feb 14, 2025

Regarding the assumption: [_, _, 2] is not always a binary classifier, it could also be a multi-output regression, though that is a rare case and probably just <3% of real-life cases. Since you added warning I would hope that our users understand if they went wrong and fix the error.

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

Labels

enhancement Indicates new feature requests visualization Relating to plotting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: beeswarm summary plot does not work after a random forest

3 participants