8000 FIX sklearn.tree: fix validation of class_names argument for plot_tree by 2maz · Pull Request #26903 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

FIX sklearn.tree: fix validation of class_names argument for plot_tree #26903

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

Merged
merged 6 commits into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions doc/whats_new/v1.3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ Changelog
:attr:`sklearn.neighbors.KDTree.valid_metrics` as public class attributes.
:pr:`26754` by :user:`Julien Jerphanion <jjerphan>`.

:mod:`sklearn.tree`
...................

- |Fix| :func:`tree.plot_tree` now accepts `class_names=True` as documented.
:pr:`26903` by :user:`Thomas Roehr <2maz>`

.. _changes_1_3:

Version 1.3.0
Expand Down
4 changes: 2 additions & 2 deletions sklearn/tree/_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def __repr__(self):
"decision_tree": [DecisionTreeClassifier, DecisionTreeRegressor],
"max_depth": [Interval(Integral, 0, None, closed="left"), None],
"feature_names": [list, None],
"class_names": [list, None],
"class_names": ["array-like", "boolean", None],
"label": [StrOptions({"all", "root", "none"})],
"filled": ["boolean"],
"impurity": ["boolean"],
Expand Down Expand Up @@ -134,7 +134,7 @@ def plot_tree(
Names of each of the features.
If None, generic names will be used ("x[0]", "x[1]", ...).

class_names : list of str or bool, default=None
class_names : array-like of str or True, default=None
Names of each of the target classes in ascending numerical order.
Only relevant for classification and not supported for multi-output.
If ``True``, shows a symbolic representation of the class name.
Expand Down
0