oegedijk / explainerdashboard

Quickly build Explainable AI dashboards that show the inner workings of so-called "blackbox" machine learning models.
http://explainerdashboard.readthedocs.io
MIT License
2.29k stars 331 forks source link

Error loading layout #205

Open seyidcemkarakas opened 2 years ago

seyidcemkarakas commented 2 years ago

When i run this code

explainer = ClassifierExplainer(model_lightgbm, x_test, y_test)
ExplainerDashboard(explainer).run(mode='external')

I am getting error like => Error loading layout image

How can i fix it ?

BTW my database is large, containing 7 columns and approximately 14000 row. Could this info be the reason of not opening ?

oegedijk commented 2 years ago

Hi @seyidcemkarakas,

No that does not sound too large to me.

The error is not really clear though.

When you click on the blue circle <> thingie, can you get some additional errors out?

oegedijk commented 2 years ago

any more detailed error messages?

seyidcemkarakas commented 2 years ago

Hi @oegedijk , firstly thanks for feedback.

Secondly, nothing happened when i click <> circle, i just clicked the callbacks button and little frame appears and still nothing.

image

oegedijk commented 2 years ago

Hmm, these can be a little annoying to debug. Usually it is due to non-existing callback id's.

Does the standard demo code work?

e.g. does this work:

from sklearn.ensemble import RandomForestClassifier
from explainerdashboard import ClassifierExplainer, ExplainerDashboard
from explainerdashboard.datasets import titanic_survive, titanic_names

X_train, y_train, X_test, y_test = titanic_survive()
model = RandomForestClassifier().fit(X_train, y_train)

explainer = ClassifierExplainer(model, X_test, y_test)
ExplainerDashboard(explainer, shap_interaction=False).run()

Could it be that you have some non-standard characters in your column names?

achimgaedke commented 2 years ago

Hi there! I do have similar problems.

I tend to work with datasets in the millions (should mention lot of noise/correlation/class imbalance before you think I live in DS heaven).

For the explainer dashboard I use only 10k of the samples, but am at the limits.

So, some observations and tentative solutions after looking at the network stats:

Get all external assets from the CDN, i.e. set

db.app.scripts.config.serve_locally = False
db.app.css.config.serve_locally = False

Looking into the _dash-layout resource, you'll see all labels repeated several times.

            return dcc.Dropdown(id=self.name, 
                                options = [str(idx) for idx in self.explainer.get_index_list()],
                                placeholder=f"Select {self.explainer.index_name} here...",
                                value=self.index
                               )

using a list of strings instead of a list of dictionaries with label and value strings. That chops the file into half.

Of course, it would be great to find a nifty solution to avoid having the index selector options in this file...

achimgaedke commented 2 years ago

Oh, there are "dynamic options" in https://dash.plotly.com/dash-core-components/dropdown

oegedijk commented 2 years ago

Try using index_dropdown=False?