8000 FIX fix validation of class_names argument for plot_tree (#26903) · punndcoder28/scikit-learn@91e4bbd · GitHub
[go: up one dir, main page]

Skip to content

Commit 91e4bbd

Browse files
2mazthomasjpfan
authored andcommitted
FIX fix validation of class_names argument for plot_tree (scikit-learn#26903)
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
1 parent 8e0a5a6 commit 91e4bbd

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

doc/whats_new/v1.3.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ Changelog
2323
:attr:`sklearn.neighbors.KDTree.valid_metrics` as public class attributes.
2424
:pr:`26754` by :user:`Julien Jerphanion <jjerphan>`.
2525

26+
:mod:`sklearn.tree`
27+
...................
28+
29+
- |Fix| :func:`tree.plot_tree` now accepts `class_names=True` as documented.
30+
:pr:`26903` by :user:`Thomas Roehr <2maz>`
31+
2632
.. _changes_1_3:
2733

2834
Version 1.3.0

sklearn/tree/_export.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def __repr__(self):
7979
"decision_tree": [DecisionTreeClassifier, DecisionTreeRegressor],
8080
"max_depth": [Interval(Integral, 0, None, closed="left"), None],
8181
"feature_names": [list, None],
82-
"class_names": [list, None],
82+
"class_names": ["array-like", "boolean", None],
8383
"label": [StrOptions({"all", "root", "none"})],
8484
"filled": ["boolean"],
8585
"impurity": ["boolean"],
@@ -134,7 +134,7 @@ def plot_tree(
134134
Names of each of the features.
135135
If None, generic names will be used ("x[0]", "x[1]", ...).
136136
137-
class_names : list of str or bool, default=None
137+
class_names : array-like of str or True, default=None
138138
Names of each of the target classes in ascending numerical order.
139139
Only relevant for classification and not supported for multi-output.
140140
If ``True``, shows a symbolic representat 39F2 ion of the class name.

0 commit comments

Comments
 (0)
0