-
-
Notifications
You must be signed in to change notification settings - Fork 26.2k
Closed as not planned
Labels
Description
Describe the bug
When using plot_tree
with filled=True
(so the nodes are colored), one sometimes gets a ValueError
such as
Invalid RGBA argument: '#cb 3-8d'
The same plot_tree
will work fine if filled=False
, and draw a decision tree. Below is an example. I attach two files with the dump of the DecisionTree and the list of columns used.
Thank you.
Steps/Code to Reproduce
# BUG: fails with ValueError: Invalid RGBA argument: '#cb 4-8c'
import joblib
from sklearn.tree import plot_tree
dt = joblib.load('_br.dmp')
cols = joblib.load('_cols.dmp')
plot_tree(dt,
feature_names=cols,
class_names=['Reject', 'Accept'],
filled=True, rounded=True,
impurity=True,
label='root',
)
Expected Results
No ValueError should be thrown and the plot should be drawn and correctly colored.
Actual Results
ValueError Invalid RGBA argument: '#cb 3-8d'
Versions
System:
python: 3.11.4 (main, Jun 7 2023, 12:45:48) [GCC 11.3.0]
executable: /mnt/c/Workspace/py-pip-workspaces/pert.ai.main/.venv/bin/python
machine: Linux-5.15.153.1-microsoft-standard-WSL2-x86_64-with-glibc2.35
Python dependencies:
sklearn: 1.5.1
pip: 24.2
setuptools: 65.5.0
numpy: 1.26.4
scipy: 1.12.0
Cython: None
pandas: 2.2.2
matplotlib: 3.9.1
joblib: 1.3.2
threadpoolctl: 3.3.0
Built with OpenMP: True
threadpoolctl info:
user_api: blas
internal_api: openblas
num_threads: 8
prefix: libopenblas
filepath: /mnt/c/Workspace/py-pip-workspaces/pert.ai.main/.venv/lib/python3.11/site-packages/numpy.libs/libopenblas64_p-r0-0cf96a72.3.23.dev.so
version: 0.3.23.dev
threading_layer: pthreads
architecture: SkylakeX
user_api: blas
internal_api: openblas
num_threads: 8
prefix: libopenblas
filepath: /mnt/c/Workspace/py-pip-workspaces/pert.ai.main/.venv/lib/python3.11/site-packages/scipy.libs/libopenblasp-r0-23e5df77.3.21.dev.so
version: 0.3.21.dev
threading_layer: pthreads
architecture: SkylakeX
user_api: openmp
internal_api: openmp
num_threads: 8
prefix: libgomp
filepath: /mnt/c/Workspace/py-pip-workspaces/pert.ai.main/.venv/lib/python3.11/site-packages/scikit_learn.libs/libgomp-a34b3233.so.1.0.0
version: None