diff --git a/doc/whats_new/v1.3.rst b/doc/whats_new/v1.3.rst index 8d39ca2fed143..e0df3c1beba4b 100644 --- a/doc/whats_new/v1.3.rst +++ b/doc/whats_new/v1.3.rst @@ -23,6 +23,12 @@ Changelog :attr:`sklearn.neighbors.KDTree.valid_metrics` as public class attributes. :pr:`26754` by :user:`Julien Jerphanion `. +: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 diff --git a/sklearn/tree/_export.py b/sklearn/tree/_export.py index 02f8ea81404c7..c89333aa49831 100644 --- a/sklearn/tree/_export.py +++ b/sklearn/tree/_export.py @@ -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"], @@ -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.