Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
yusufuyanik1 committed Dec 31, 2024
2 parents 2868e7c + 8550e2d commit 0e443e2
Show file tree
Hide file tree
Showing 29 changed files with 1,258 additions and 1,126 deletions.
12 changes: 3 additions & 9 deletions examples/articles/GettingStarted.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,11 @@
"If you do not have Python or no compatible version installed, `uv` will automatically install a compatible version.\n",
"\n",
"## Optional dependencies\n",
"As of V4 of pdstools, we have made a big effort to reduce the number of big and heavy core dependencies. This means that while initial installation is very fast, you may at some points run into import errors and will be required to install additional dependency groups. If using `uv`, these can be installed with the `--extra` argument. \n",
"As of V4 of pdstools, we have made a big effort to reduce the number of big and heavy core dependencies. This means that while initial installation is very fast, you may at some points run into import errors and will be required to install additional dependency groups. \n",
"\n",
"For instance, to install the optional dependencies to use the Pega DX API client, you should run \n",
"\n",
"```bash\n",
"uv pip install pdstools --extra api\n",
"```\n",
"\n",
"The alternative (pip-compatible) syntax for optional dependencies is:\n",
"To install extra dependencies, you can put them in square brackets after a package name. So, for instance, to install pdstools alongside the optional dependencies for the Pega DX API client, you should run:\n",
"```bash\n",
"pip install 'pdstools[api]'\n",
"uv pip install 'pdstools[api]'\n",
"```\n",
"\n",
"For an overview of all optional dependencies and the dependency groups they will be installed for, see the table below:\n",
Expand Down
168 changes: 168 additions & 0 deletions examples/ih/Conversion_Reporting.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
{
"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.plot.overall_gauges(\n",
" metric=\"Conversion\",\n",
" condition=\"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.plot.success_rates_tree_map(metric=\"Conversion\")\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.plot.success_rates_trend_bar(\n",
" metric=\"Conversion\",\n",
" condition=\"ExperimentGroup\",\n",
" every=\"1w\",\n",
")\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ih.plot.success_rates_trend(metric=\"Conversion\", every=\"1d\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Engagement"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ih.plot.overall_gauges(\n",
" condition=\"ExperimentGroup\",\n",
" by=\"Channel\",\n",
" reference_values={\"Web\": 0.20, \"Email\": 0.20},\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ih.plot.success_rates_trend(\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"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Loading

0 comments on commit 0e443e2

Please sign in to comment.