interpret icon indicating copy to clipboard operation
interpret copied to clipboard

Databricks Render multiple visualizations

Open jakedubb opened this issue 6 years ago • 13 comments
trafficstars

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 avatar Oct 24 '19 22:10 jakedubb

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

jakedubb avatar Oct 25 '19 15:10 jakedubb

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

interpret-ml avatar Nov 15 '19 20:11 interpret-ml

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

hanman2016 avatar Mar 04 '20 07:03 hanman2016

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.

akshararama avatar Jun 30 '20 19:06 akshararama

@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

jakeatmsft avatar Jun 30 '20 20:06 jakeatmsft

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!

SoulEvill avatar Jul 14 '20 05:07 SoulEvill

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

interpret-ml avatar Oct 20 '20 23:10 interpret-ml

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

bubu-chikvinidze avatar Jan 26 '22 10:01 bubu-chikvinidze

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

hommayushi3 avatar Jul 19 '23 23:07 hommayushi3

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 avatar Sep 21 '23 19:09 djoconnell34

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)

djoconnell34 avatar Sep 22 '23 18:09 djoconnell34

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.

paulbkoch avatar Sep 22 '23 19:09 paulbkoch

@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.

jasongrout-db avatar Mar 29 '24 18:03 jasongrout-db