interpretml / interpret

Fit interpretable models. Explain blackbox machine learning.
https://interpret.ml/docs
MIT License
6.22k stars 726 forks source link

Databricks Render multiple visualizations #88

Open jakedubb opened 4 years ago

jakedubb commented 4 years ago

When rendering visualizations using show() in databricks I am only able to render 1 visualization at a time. All subsequent attempts display this error:

Uncaught TypeError: Cannot read property 'RenderApp' of undefined

Can we worked around by restarting python using following command: dbutils.library.restartPython()

and rerunning notebook with a different visualization. But essentially after the first visualization renders all others fail.

jakedubb commented 4 years ago

As a followup, is there any function for extracting FeatureValueExplanation directly to dataframes? This would partially solve my issue in Databricks

interpret-ml commented 4 years ago

Hi @jakedubb,

Thanks for reporting this! We are actively looking into this, and will report back once we have some better answers.

To answer your follow up question: "is there any function for extracting FeatureValueExplanation directly to dataframes?"

You won't be able to extract things directly to dataframes, but you can call .data() on any Explanation to extract the underlying data. The .data() method also takes in a "key" argument, ex: explanation.data(key=0) to pull out the specific data for an individual visualization (like an individual EBM graph). The data() method returns a dictionary that should be fairly easy to massage into a DataFrame of your choosing.

Alternatively, you can also directly call explanation.visualize(key=0) to directly produce a graph. Hopefully the .data() and .visualize() are sufficient temporary workarounds as we look into the databricks issue.

Thanks, -InterpretML Team

hanman2016 commented 4 years ago

The below error received when executed following code in Azure Databricks. Please suggest action item.

from interpret.blackbox import LimeTabular from interpret import show

lime = LimeTabular(predict_fn=blackbox_model.predict_proba, data=X_train, random_state=1) lime_local = lime.explain_local(X_test[:5], y_test[:5], name='LIME') show(lime_local)

============================================= Uncaught TypeError: Cannot read property 'RenderApp' of undefined

akshararama commented 4 years ago

Was this ever resolved? I am still getting that same Uncaught TypeError: Cannot read property 'RenderApp' of undefined when I try to have multiple visualization in the same databricks notebook. The visualize workaround is hard to use since I have a lot of different variables to visualize.

jakeatmsft commented 4 years ago

@akshararama - I am able to render multiple ExplanationDashboard widgets in the same notebook.

DB cluster version - 7.0 ML Libraries:

azureml-sdk[explain,interpret,databricks] PyPI

fairlearn PyPI

flask_cors PyPI

interpret-community[visualization] PyPI

sklearn_pandas PyPI

SoulEvill commented 4 years ago

I am having the same issues, still getting the error: Uncaught TypeError: Cannot read property 'RenderApp' of undefined

I tried to install the same library as shown above and same runtime 7.0 ML. only difference is that I am using AWS not Azure. but I am still only able to render 1 visualization at once by use visualize(key=n).

Sometime I will get different error:

Error: RangeError: Maximum call stack size exceeded at RegExp.exec () at new m.fn.init (https://******.cloud.databricks.com/js/main.7cdf21c6.js:1:6620137) at m (https://******.cloud.databricks.com/js/main.7cdf21c6.js:1:6596167) at r.updateResultDiv (https://******.cloud.databricks.com/js/main.7cdf21c6.js:1:3469902) at render0 (https://******.cloud.databricks.com/js/main.7cdf21c6.js:1:3460196) at render (https://******.cloud.databricks.com/js/main.7cdf21c6.js:1:3458519) at r.createWidgetView (https://******.cloud.databricks.com/js/main.7cdf21c6.js:1:3495160) at r.addWidgetView (https://******.cloud.databricks.com/js/main.7cdf21c6.js:1:3495325) at render (https://******.cloud.databricks.com/js/main.7cdf21c6.js:1:3492915) at t.renderDashboardView (https://******.cloud.databricks.com/js/main.7cdf21c6.js:1:2157749)

Can you take a look? Much appreciated!

interpret-ml commented 3 years ago

We've made some improvements in our Databricks support, which should hopefully resolve these issues. We'll leave this issue open for now in case anyone still has problems.

-InterpretML

bubu-chikvinidze commented 2 years ago

I am having the same issue trying to render html with displayHTML function in databricks

hommayushi3 commented 1 year ago

I am also running into this same issue with multiple visualizations in Databricks with the most recent interpretml version.

djoconnell34 commented 1 year ago

Hello, has anyone been able to solve the initial issue, of only one show() visualization being rendered in databricks? I have done a good amount of troubleshooting and cannot solve the issue. I have tried many versions of interpret and other packages. Thanks

djoconnell34 commented 12 months ago

Hello! Thanks @paulbkoch and @interpret-ml for opening this ticket back up! I just solved my issue though. For some reason 'InlineProvider' did not know the environment. We just switched to the newer Databricks Architecture (E2) and maybe our security settings messed it up. I have had to specify our environment as 'databricks' for some other packages since switching to E2, so I don't think it was an Interpret issue.

Error Message after using the show() function once and trying to use show() again. Uncaught TypeError: Cannot read property 'RenderApp' of undefined

Hope the following helps if anyone else runs into the same problem. Create an instance of the 'InlineProvider', change the instance's method 'detected_envs' to 'databricks' and then 'set_visualize_provider' with that instance. See below!

from interpret import set_visualize_provider from interpret.provider import InlineProvider in_pro= InlineProvider() in_pro.detected_envs = 'databricks' set_visualize_provider(in_pro)

paulbkoch commented 12 months ago

Thanks @djoconnell34 for the update. I'll leave the issue in our backlog to fix the auto-detection. Good to hear it works with the right settings though.

jasongrout-db commented 5 months ago

@paulbkoch - I work at Databricks on the notebook frontend, and this error came on our radar. Please let us know if you have any questions about getting interpret to work in Databricks.