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]: How do we show the pycaret.anomaly.plot_model(model, plot = 'tsne') in production code in a frontend of website? #2579

Closed revanks closed 2 years ago

revanks commented 2 years ago

pycaret version checks

Issue Description

In Pycaret Anomaly module we are able to plot **tsne** plots in jupyter notebook, but in case production code I also need to show same tsne plots in frontend of website. I think this feature available in Streamlit, but I am using FastAPI framework. Is there any way to get these plots please let me know. Thanks

from pycaret.datasets import get_data anomaly = get_data('anomaly') from pycaret.anomaly import * exp_name = setup(data = anomaly) knn = create_model('knn') plot_model(knn, plot = 'tsne')

Reproducible Example

from pycaret.datasets import get_data
anomaly = get_data('anomaly')
from pycaret.anomaly import *
exp_name = setup(data = anomaly)
knn = create_model('knn')
plot_model(knn, plot = 'tsne')

Expected Behavior

from pycaret.datasets import get_data anomaly = get_data('anomaly') from pycaret.anomaly import * exp_name = setup(data = anomaly) knn = create_model('knn') plot_model(knn, plot = 'tsne')

Actual Results

from pycaret.datasets import get_data
anomaly = get_data('anomaly')
from pycaret.anomaly import *
exp_name = setup(data = anomaly)
knn = create_model('knn')
plot_model(knn, plot = 'tsne')

Installed Versions

python 3.8
moezali1 commented 2 years ago

@revanks You can use the save parameter to save the image and then load it whereever you want. If you are using streamlit as front-end, easier way is to set display_format='streamlit'.