dtreeviz icon indicating copy to clipboard operation
dtreeviz copied to clipboard

node_stats for nodes with features including string values.

Open parrt opened this issue 2 years ago • 2 comments

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')

parrt avatar Mar 02 '23 17:03 parrt

I thought that you already made the fix :D

tlapusan avatar Mar 03 '23 06:03 tlapusan

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

parrt avatar Mar 03 '23 17:03 parrt