Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 128 #134

Closed
wants to merge 4 commits into from
Closed

Issue 128 #134

wants to merge 4 commits into from

Conversation

operdeck
Copy link
Collaborator

Standalone model report complete content-wise. Remains some TODOs to clean up code, move to PDS tools library and generally make sure it is robust and the numbers compare visavis the R version.

jupyter: python3
---

```{python}
import sys
sys.path.append('/Users/perdo/Documents/pega/pega-datascientist-tools/python')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget to remove this at some point ;)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you can build a test that fails if such lines are still there. I do something similar for the R version, a test fails if it finds un-commented library source inclusion.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right yeah I think something like that would be cool. Probably in tandem with adding default linters/formatters. I'll create an issue for that, wanted tot do it anyway

```

```{python}
#| tags: [parameters]

# These parameters are overwritten when called externally

# TODO see if we can align with the params of the Health Check
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do we need for this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to support calling from CLI - and HC quarto updated with the same now

```

```{python}
#| tags: [parameters]

# These parameters are overwritten when called externally

# TODO see if we can align with the params of the Health Check

datafolder = os.path.expanduser("~/Downloads/tmp/")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you link this to a url location maybe?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant rather than having a hardcoded url to /downloads/tmp, are the files in github? Then you can just link to the file in github directly

```{python}
# TODO to make generic make sure these context keys really exist, do intersect with names in the model data

channel_name = datamart.modelData.select(pl.concat_str(["Direction", "Channel"], separator="/")).unique().collect().item()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't you easily use your fancy .format function here?

```

```{python}
# TODO perhaps this should move into the pdstools plot functions "plotCumulativeLift"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's do it

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See below

fig.show()

# "Philip Mann" plot with simple red/green lift bars relative to base propensity
# TODO move below "Philip Mann" plot into a plot function (plotBinningLift)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Highlighting as not to forget

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The plot functions are a little daunting, I'll first get the quarto feature complete then move things around

yaxis = dict(autorange="reversed"),
title="Propensity Lift", xaxis_title="", yaxis_title="")
# Not convinced why we need below. It should respect the binindex order but w/o this it doesnt always.
fig.update_yaxes(categoryorder='array', categoryarray=pm_plot_binning_table['BinSymbol'])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, if there's no missing bin, it tries to cast to numeric and tries to do magic with sorting. If there's a missing bin, then casting to numeric will fail and it will just keep the order

title="Propensity Lift", xaxis_title="", yaxis_title="")
# Not convinced why we need below. It should respect the binindex order but w/o this it doesnt always.
fig.update_yaxes(categoryorder='array', categoryarray=pm_plot_binning_table['BinSymbol'])
# TODO: when there are many bins not all are always shown, figure out how to fix
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

python/pdstools/reports/ModelReport.qmd Show resolved Hide resolved
python/pdstools/utils/cdh_utils.py Show resolved Hide resolved
@StijnKas
Copy link
Collaborator

Process Mining is going to get some abbreviation competition with Mr. Mann if he keeps thinking of new plots ;)

@operdeck operdeck self-assigned this Oct 11, 2023
@operdeck
Copy link
Collaborator Author

Will send a new one in - most remarks left as TODOs for now

@operdeck operdeck closed this Oct 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants