MAIF / shapash

🔅 Shapash: User-friendly Explainability and Interpretability to Develop Reliable and Transparent Machine Learning Models
https://maif.github.io/shapash/
Apache License 2.0
2.71k stars 329 forks source link

SmartExplainer: sometimes can not handle input data that have more than 5 variables #523

Open brahim7 opened 7 months ago

brahim7 commented 7 months ago

I said in the title above sometimes ...because the behavior is random. 1-I did two tests, passing my Xtest data which have 5 variables and all works good. but ones I pass into Smartexplainer a data frame with same format as Xtest but has more than 5 variables, the error bellow appear. my table type is float32 based from input text originally. the error: AttributeError: 'DataFrame' object has no attribute 'dtype'.....which is not true

2-I tried to upgrade the shapash version but I still also have this warning

Code 👍 xpl = SmartExplainer( model=model )

xpl.compile(x=Xtest, y_pred=y_pred)

app = xpl.run_app()

\smart_app.py:126: FutureWarning:

DataFrame.applymap has been deprecated. Use DataFrame.map instead.

T raceback (most recent call last):

Cell In[8], line 369 app = xpl.run_app()

File ~\anaconda3\Lib\site-packages\shapash\explainer\smart_explainer.py:1079 in run_app self.smartapp = SmartApp(self, settings)

File ~\anaconda3\Lib\site-packages\shapash\webapp\smart_app.py:137 in init self.init_data()

File ~\anaconda3\Lib\site-packages\shapash\webapp\smart_app.py:207 in init_data typ = self.dataframe[col].dtype

File ~\anaconda3\Lib\site-packages\pandas\core\generic.py:6204 in getattr return object.getattribute(self, name)

AttributeError: 'DataFrame' object has no attribute 'dtype'

Python version :Python 3.11.5 64-bit | Qt 5.15.2 | PyQt5 5.15.7 | Spyder IDE 5.4.3

Shapash version : 2.4.1

Operating System :Windows 10

guerinclement commented 6 months ago

Hello brahim7, Could you please provide a full executable example so we can reproduce your issue?