FIX sklearn.tree: fix validation of class_names argument for plot_tree#26903
FIX sklearn.tree: fix validation of class_names argument for plot_tree#26903thomasjpfan merged 6 commits intoscikit-learn:mainfrom
Conversation
sklearn/tree/_export.py
Outdated
| "max_depth": [Interval(Integral, 0, None, closed="left"), None], | ||
| "feature_names": [list, None], | ||
| "class_names": [list, None], | ||
| "class_names": [list, None, "boolean"], |
There was a problem hiding this comment.
While we're here, we should probably also change list to "array-like" similarly to export_graphviz. Also, totally just a nit-pick, but I like keeping None as the final option by convention :)
| "class_names": [list, None, "boolean"], | |
| "class_names": ["array-like", "boolean", None], |
There was a problem hiding this comment.
Thanks for the quick feedback. Just updated accordingly.
|
@2maz Just for future reference, please avoid force-pushing commits in these PRs. It's totally okay for now, but in general we prefer to maintain the commit history within the branch/PR. When, eventually, we merge these into It helps for keeping history, debugging, and following development. Let me know if you have any questions/concerns regarding this. Thanks :) |
thomasjpfan
left a comment
There was a problem hiding this comment.
Thank you for the PR @2maz !
|
I think this is a bug fix and should be in 1.3.1. Please add an entry to the change log at |
True is the only available boolean option
…n#26903) Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
…n#26903) Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
…n#26903) Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
Reference Issues/PRs
What does this implement/fix? Explain your changes.
In sklearn.tree.plot_tree: allow documented use of 'class_names' arguments, i.e. setting class_names=True
Currently this raises:
Replicate with:
Any other comments?
Reproducible with the above code snippet