parrt / dtreeviz

A python library for decision tree visualization and model interpretation.
MIT License
2.89k stars 332 forks source link

node_stats for nodes with features including string values. #276

Open parrt opened 1 year ago

parrt commented 1 year ago

When creating a data frame from a numpy, by default it converts all dtypes to object in case it contains different dtypes (float and str in our case)... https://stackoverflow.com/questions/61346021/create-a-mixed-type-pandas-dataframe-using-an-numpy-array-of-type-object

Solution:

df = pd.DataFrame(self.shadow_tree.X_train, columns=self.shadow_tree.feature_names).convert_dtypes()
return df.iloc[node_samples[node_id]].describe(include='all')
tlapusan commented 1 year ago

I thought that you already made the fix :D

parrt commented 1 year ago

hahah. nope was working on the tutorial and now they want a blog post haha