-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #299 from pegasystems/Conversion_Monitoring
Initial version of conversion modeling on IH
- Loading branch information
Showing
9 changed files
with
808 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from pdstools import IH\n", | ||
"\n", | ||
"import plotly.io as pio\n", | ||
"import plotly as plotly\n", | ||
"\n", | ||
"plotly.offline.init_notebook_mode()\n", | ||
"pio.renderers.default = \"vscode\"" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Conversion Results\n", | ||
"\n", | ||
"Visualization of conversion modeling results from IH data." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from pathlib import Path\n", | ||
"import polars as pl\n", | ||
"\n", | ||
"ih_export_file = Path(\n", | ||
" \"./Data-pxStrategyResult_InteractionFiles_20241213T091932_GMT.zip\"\n", | ||
")\n", | ||
"\n", | ||
"if not ih_export_file.exists():\n", | ||
" ih = IH.from_mock_data()\n", | ||
"else:\n", | ||
" ih = IH.from_ds_export(\n", | ||
" ih_export_file,\n", | ||
" query=pl.col.ExperimentGroup.is_not_null() & (pl.col.ExperimentGroup != \"\"),\n", | ||
" )\n", | ||
"\n", | ||
"ih.aggregates.summary_success_rates(by=[\"ExperimentGroup\", \"Channel\"]).drop(\n", | ||
" \"Outcomes\"\n", | ||
").collect().to_pandas().style.hide()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"ih.plots.conversion_overall_gauges(\n", | ||
" experiment_field=\"ExperimentGroup\",\n", | ||
" by=\"Channel\",\n", | ||
" reference_values={\"Web\": 0.055, \"Email\": 0.09},\n", | ||
")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## Detailed View \n", | ||
"\n", | ||
"Showing conversion rates for all actions." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"ih.plots.conversion_success_rates_tree_map()\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## Conversion Rate Trends\n", | ||
"\n", | ||
"side-by-side bars and lines (separate methods) with error bars" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"ih.plots.conversion_success_rates_trend_bar(\n", | ||
" experiment_field=\"ExperimentGroup\",\n", | ||
" every=\"1w\",\n", | ||
")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Engagement" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"ih.plots.egagement_overall_gauges(\n", | ||
" experiment_field=\"ExperimentGroup\",\n", | ||
" by=\"Channel\",\n", | ||
" reference_values={\"Web\": 0.20, \"Email\": 0.20},\n", | ||
")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"ih.plots.conversion_success_rates_trend_line(\n", | ||
" by=\"Channel\"\n", | ||
")" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": ".venv", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.12.3" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.