pegasystems / pega-datascientist-tools

Pega Data Scientist Tools
https://github.com/pegasystems/pega-datascientist-tools/wiki
Apache License 2.0
33 stars 24 forks source link

plotPredictorCategoryPerformance with multiple facets returns a configuration rather than a plot #249

Closed operdeck closed 6 days ago

operdeck commented 1 month ago

pdstools version checks

Issue description

Given a dm with model and predictor data, the following all work fine, returning the expected plots

dm.plotPredictorCategoryPerformance(facets=["Issue"])
dm.plotPredictorCategoryPerformance(facets=["Channel"])
dm.plotPredictorCategoryPerformance()

but when I combine both

dm.plotPredictorCategoryPerformance(facets=["Issue", "Channel"]) I get a JSON dump of a plotly Figure configuration

[Figure({
     'data': [{'alignmentgroup': 'True',
               'hovertemplate': ('Legend=Customer<br>Issue=NA<br' ... 'orCategory=%{y}<extra></extra>'),
               'legendgroup': 'Customer',
               'marker': {'color': '#001F5F'},
               'name': 'Customer',
               'notched': False,
               'offsetgroup': 'Customer',
(etc)
image

Reproducible example

from pdstools import ADMDatamart, datasets
dm = datasets.CDHSample()
dm.plotPredictorCategoryPerformance(facets=["Issue", "Channel"])

Expected behavior

Expected a 2-d facetted plot

Installed versions

``` ---Version info--- pdstools: 3.4.4 Platform: macOS-14.5-arm64-arm-64bit Python: 3.12.3 (v3.12.3:f6650f9ad7, Apr 9 2024, 08:18:47) [Clang 13.0.0 (clang-1300.0.29.30)] ---Dependencies--- plotly: 5.22.0 requests: 2.32.3 pydot: 2.0.0 polars: 0.20.31 pyarrow: 16.1.0 tqdm: 4.66.4 pyyaml: aioboto3: 13.0.1 ---Streamlit app dependencies--- streamlit: quarto: papermill: 2.6.0 itables: pandas: 2.2.2 jinja2: 3.1.4 xlsxwriter: 3.2.0```
StijnKas commented 1 month ago

It's not actually a json @operdeck - it is a list of plotly objects. If you loop through them and call show() on them, they will appear.

It's probably not an optimal implementation, but I don't really know how else we should solve this: having it all as one big plotly plot probably doesn't improve things either.

operdeck commented 1 month ago

Ah in that case lets close this

Op wo 24 jul 2024 om 11:07 schreef Stijn Kas @.***>

It's not actually a json @operdeck https://github.com/operdeck - it is a list of plotly objects. If you loop through them and call show() on them, they will appear.

It's probably not an optimal implementation, but I don't really know how else we should solve this: having it all as one big plotly plot probably doesn't improve things either.

— Reply to this email directly, view it on GitHub https://github.com/pegasystems/pega-datascientist-tools/issues/249#issuecomment-2247307310, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABEVTKD2V5A4P5CTQQYJ44TZN5VGRAVCNFSM6AAAAABLCPQCZ2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBXGMYDOMZRGA . You are receiving this because you were mentioned.Message ID: @.***>