pycaret / pycaret

An open-source, low-code machine learning library in Python
https://www.pycaret.org
MIT License
8.93k stars 1.77k forks source link

[BUG]: plot_model, evaluate_model not producing any output in databricks #2831

Closed Prashavu closed 1 year ago

Prashavu commented 2 years ago

pycaret version checks

Issue Description

No graph/plot is produced after riunning the code

Reproducible Example

fig = plt.figure(figsize=(18,6))
ax = fig.add_subplot(5,2,1)
plot_model(blender, plot='cooks', save=True, verbose=False, scale=1.1)
ax = fig.add_subplot(5,2,2)
plot_model(blender, plot='manifold', save=True, verbose=False, scale=1.1)
#plt.savefig('plots_cooks_and_manifold.png', dpi=300, pad_inches=0.25)
plt.show()

Expected Behavior

matplotlib plot expected

Actual Results

nothing is displayed after running the code to plot

Installed Versions

2.3.10
asmaier commented 2 years ago

The pycaret NLP tutorial also doesn't show any plots on databricks. Mainly the problem is, that it internally pycaret uses plotly/cufflinks to create the plots, which does not work out of the box with databricks zeppelin notebooks. Unfortunately the pycaret plot_model() function also does not return the figure object so that it is impossible to use the databricks renderer for plotly in combination with pycaret like

import pandas as pd
import cufflinks as cf
cf.go_offline()

df = pd.DataFrame([1,2,3,3,2,1])

fig = df.iplot(asFigure=True)
# using the databricks renderer to show the figure
fig.show("databricks")

See https://github.com/nicolaskruchten/plotly_img_test/blob/master/Untitled.ipynb

moezali1 commented 1 year ago

@asmaier I have tested the latest rc4 release of pycaret pycaret==3.0.0rc4 on Databricks community edition. plot_model function works fine. evaluate_model doesn't work because of no support of IPython.

In Databricks Runtime 11.0 and above, Python notebooks use the IPython kernel to execute Python code.

Read More: https://docs.databricks.com/notebooks/ipython-kernel.html