dtreeviz icon indicating copy to clipboard operation
dtreeviz copied to clipboard

AttributeError: 'Rectangle' object has no attribute 'patches'

Open tlapusan opened this issue 2 years ago • 5 comments

We introduced this fix here : https://github.com/parrt/dtreeviz/pull/266, when a node will not contain samples from each label.

By filtering out those labels, we can have the situation when only a single label will be in a node, which will raise this error : AttributeError: 'Rectangle' object has no attribute 'patches'

tlapusan avatar Mar 12 '23 08:03 tlapusan

After last update, errors below often occur in my case. ValueError: The 'color' keyword argument must have one color per dataset, but 1 datasets and 0 colors were provided, AttributeError: 'Rectangle' object has no attribute 'patches' ValueError: need at least one array to concatenate

I think that these errors completely depend on the structure of the tree built.

Moreover, "try-except pass" structure doesn't work in the error of concatenation and I can't ignore the error message below.

image

baligoyem avatar Apr 14 '23 06:04 baligoyem

@baligoyem what version of the library are you using?

tlapusan avatar Apr 15 '23 08:04 tlapusan

@baligoyem and also which type of visualisation are you trying to make ? Your screenshot seems to be from path.py module from matplotlib library..

@parrt I think we don't have the latest PRs from dev into master and releases on pipy repository.

tlapusan avatar Apr 15 '23 12:04 tlapusan

@tlapusan

matplotlib==3.5.3 dtreeviz==2.2.0 lightgbm==3.3.3

I always get these errors when I try to build a dtreeviz model tree using LightGBM algorithm. There is no problem with sklearn trees.

baligoyem avatar Apr 17 '23 06:04 baligoyem

@baligoyem we just made a new release 2.2.1. Can you check if it solves your issue ? thanks

tlapusan avatar Apr 19 '23 07:04 tlapusan