Problem: TypeError: cannot use a string pattern on a bytes-like object
catboost version: 0.15.2
Operating System: Ubuntu 19.04
CPU: Intel(R) Core(TM) i5-7400 CPU @ 3.00GHz
I got over the issue AttributeError: 'str' object has no attribute 'decode' which already has this fix.
I've applied the changes and got a new error:
~/.local/lib/python3.7/site-packages/graphviz/lang.py in quote(identifier, html, valid_id, dot_keywords)
48 '"<>"'
49 """
---> 50 if html(identifier) and not isinstance(identifier, NoHtml):
51 pass
52 elif not valid_id(identifier) or identifier.lower() in dot_keywords:
TypeError: cannot use a string pattern on a bytes-like object
The code I am running is same as in Visualization of CatBoost decision trees tutorial
We'll look into this
I also meet this quesition
@annaveronika this occurs when trying to add the leaf nodes, specifically
node_label = leaf_values[node_num] # core.py line 2480
leaf_values[node_num] is byte not str
A fix is to revert the change https://github.com/catboost/catboost/commit/2e9b80146d93d8112119e961015b860346a84477 for the leaf_values (I'm not sure if this is general) i.e.
if split_num >= 0:
node_label = splits[split_num].replace('bin=', 'value>', 1)
color = 'black'
shape = 'ellipse'
else:
node_label = leaf_values[node_num].decode('utf-8')
color = 'red'
shape = 'rect'
This is fixed in catboost 0.16.3
Most helpful comment
We'll look into this