blob: 86337d2bd1e954abcb54afa231680610e4edfe51 [file]
{
"cells": [
{
"cell_type": "markdown",
"source": [
"Uncomment and run the cell below if you are in a Google Colab environment. It will:\n",
"1. Mount google drive. You will be asked to authenticate and give permissions.\n",
"2. Change directory to google drive.\n",
"3. Make a directory \"hamilton-tutorials\"\n",
"4. Change directory to it.\n",
"5. Clone this repository to your google drive\n",
"6. Move your current directory to the hello_world example\n",
"7. Install requirements.\n",
"\n",
"This means that any modifications will be saved, and you won't lose them if you close your browser."
],
"metadata": {
"collapsed": false
}
},
{
"cell_type": "code",
"execution_count": null,
"outputs": [],
"source": [
"## 1. Mount google drive\n",
"# from google.colab import drive\n",
"# drive.mount('/content/drive')\n",
"## 2. Change directory to google drive.\n",
"# %cd /content/drive/MyDrive\n",
"## 3. Make a directory \"hamilton-tutorials\"\n",
"# !mkdir hamilton-tutorials\n",
"## 4. Change directory to it.\n",
"# %cd hamilton-tutorials\n",
"## 5. Clone this repository to your google drive\n",
"# !git clone https://github.com/DAGWorks-Inc/hamilton/\n",
"## 6. Move your current directory to the hello_world example\n",
"# %cd hamilton/examples/hello_world\n",
"## 7. Install requirements.\n",
"# %pip install -r requirements.txt\n",
"# clear_output() # optionally clear outputs\n",
"# To check your current working directory you can type `!pwd` in a cell and run it."
],
"metadata": {
"collapsed": false
}
},
{
"cell_type": "code",
"execution_count": 1,
"outputs": [],
"source": [
"# Cell 1 - import the things you need\n",
"import logging\n",
"import sys\n",
"\n",
"import numpy as np\n",
"import pandas as pd\n",
"\n",
"from hamilton import ad_hoc_utils, driver\n",
"\n",
"logging.basicConfig(stream=sys.stdout)"
],
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2023-11-08T00:06:17.334441Z",
"start_time": "2023-11-08T00:06:13.711650Z"
}
}
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"pycharm": {
"name": "#%%\n"
},
"ExecuteTime": {
"end_time": "2023-11-08T00:06:17.404504Z",
"start_time": "2023-11-08T00:06:17.343242Z"
}
},
"outputs": [],
"source": [
"# Cell 2 - import modules to create part of the DAG from\n",
"# We use the autoreload extension that comes with ipython to automatically reload modules when\n",
"# the code in them changes.\n",
"\n",
"# import the jupyter extension\n",
"%load_ext autoreload\n",
"# set it to only reload the modules imported\n",
"%autoreload 1\n",
"# import the function modules you want to reload when they change.\n",
"# i.e. these should be your modules you write your functions in. As you change them,\n",
"# they will be reimported without you having to do anything.\n",
"%aimport my_functions"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"pycharm": {
"name": "#%%\n"
},
"ExecuteTime": {
"end_time": "2023-11-08T00:06:17.419982Z",
"start_time": "2023-11-08T00:06:17.411216Z"
}
},
"outputs": [],
"source": [
"# Cell 3 - Define your new Hamilton functions & curate them into a TemporaryFunctionModule object.\n",
"# This enables you to add functions to your DAG without creating a proper module.\n",
"# This is ONLY INTENDED FOR QUICK DEVELOPMENT. For moving to production move these to an actual module.\n",
"\n",
"# Look at `my_functions` to see how these functions connect.\n",
"def signups() -> pd.Series:\n",
" \"\"\"Returns sign up values\"\"\"\n",
" return pd.Series([1, 10, 50, 100, 200, 400])\n",
"\n",
"\n",
"def spend() -> pd.Series:\n",
" \"\"\"Returns the spend values\"\"\"\n",
" return pd.Series([10, 10, 20, 40, 40, 50])\n",
"\n",
"\n",
"def log_spend_per_signup(spend_per_signup: pd.Series) -> pd.Series:\n",
" \"\"\"Simple function taking the logarithm of spend over signups.\"\"\"\n",
" return np.log(spend_per_signup)\n",
"\n",
"\n",
"# Place the functions into a temporary module -- the idea is that this should house a curated set of functions.\n",
"# Don't be afraid to make multiple of them -- however we'd advise you to not use this method for production.\n",
"# Also note, that using a temporary function module does not work for scaling onto Ray, Dask, or Pandas on Spark.\n",
"temp_module = ad_hoc_utils.create_temporary_module(\n",
" spend, signups, log_spend_per_signup, module_name=\"function_example\"\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"pycharm": {
"name": "#%%\n"
},
"ExecuteTime": {
"end_time": "2023-11-08T00:06:17.461900Z",
"start_time": "2023-11-08T00:06:17.422033Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"WARNING:hamilton.telemetry:Note: Hamilton collects completely anonymous data about usage. This will help us improve Hamilton over time. See https://github.com/dagworks-inc/hamilton#usage-analytics--data-privacy for details.\n"
]
}
],
"source": [
"# Cell 4 - Instantiate the Hamilton driver and pass it the right things in.\n",
"\n",
"initial_config = {}\n",
"# we need to tell hamilton where to load function definitions from\n",
"dr = driver.Driver(initial_config, my_functions, temp_module) # can pass in multiple modules\n",
"# we need to specify what we want in the final dataframe.\n",
"output_columns = [\n",
" \"spend\",\n",
" \"signups\",\n",
" \"avg_3wk_spend\",\n",
" \"spend_per_signup\",\n",
" \"spend_zero_mean_unit_variance\",\n",
"]"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"ExecuteTime": {
"end_time": "2023-11-08T00:06:18.080346Z",
"start_time": "2023-11-08T00:06:17.452028Z"
}
},
"outputs": [
{
"data": {
"image/svg+xml": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<!-- Generated by graphviz version 8.0.5 (20230430.1635)\n -->\n<!-- Pages: 1 -->\n<svg width=\"728pt\" height=\"350pt\"\n viewBox=\"0.00 0.00 727.65 349.93\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 345.93)\">\n<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-345.93 723.65,-345.93 723.65,4 -4,4\"/>\n<g id=\"clust1\" class=\"cluster\">\n<title>cluster__legend</title>\n<polygon fill=\"none\" stroke=\"black\" points=\"8,-237.8 8,-312.8 92.85,-312.8 92.85,-237.8 8,-237.8\"/>\n<text text-anchor=\"middle\" x=\"50.42\" y=\"-295.5\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">Legend</text>\n</g>\n<!-- spend_mean -->\n<g id=\"node1\" class=\"node\">\n<title>spend_mean</title>\n<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M227.32,-309.6C227.32,-309.6 146.47,-309.6 146.47,-309.6 140.47,-309.6 134.47,-303.6 134.47,-297.6 134.47,-297.6 134.47,-258 134.47,-258 134.47,-252 140.47,-246 146.47,-246 146.47,-246 227.32,-246 227.32,-246 233.32,-246 239.32,-252 239.32,-258 239.32,-258 239.32,-297.6 239.32,-297.6 239.32,-303.6 233.32,-309.6 227.32,-309.6\"/>\n<text text-anchor=\"start\" x=\"145.27\" y=\"-286.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">spend_mean</text>\n<text text-anchor=\"start\" x=\"174.15\" y=\"-258.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">float</text>\n</g>\n<!-- spend_zero_mean -->\n<g id=\"node8\" class=\"node\">\n<title>spend_zero_mean</title>\n<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M429.42,-309.6C429.42,-309.6 313.32,-309.6 313.32,-309.6 307.32,-309.6 301.32,-303.6 301.32,-297.6 301.32,-297.6 301.32,-258 301.32,-258 301.32,-252 307.32,-246 313.32,-246 313.32,-246 429.42,-246 429.42,-246 435.42,-246 441.42,-252 441.42,-258 441.42,-258 441.42,-297.6 441.42,-297.6 441.42,-303.6 435.42,-309.6 429.42,-309.6\"/>\n<text text-anchor=\"start\" x=\"312.12\" y=\"-286.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">spend_zero_mean</text>\n<text text-anchor=\"start\" x=\"352.25\" y=\"-258.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Series</text>\n</g>\n<!-- spend_mean&#45;&gt;spend_zero_mean -->\n<g id=\"edge10\" class=\"edge\">\n<title>spend_mean&#45;&gt;spend_zero_mean</title>\n<path fill=\"none\" stroke=\"black\" d=\"M239.7,-277.8C255.5,-277.8 273.24,-277.8 290.44,-277.8\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"290.06,-281.3 300.06,-277.8 290.06,-274.3 290.06,-281.3\"/>\n</g>\n<!-- spend_std_dev -->\n<g id=\"node2\" class=\"node\">\n<title>spend_std_dev</title>\n<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M234.82,-227.6C234.82,-227.6 138.97,-227.6 138.97,-227.6 132.97,-227.6 126.97,-221.6 126.97,-215.6 126.97,-215.6 126.97,-176 126.97,-176 126.97,-170 132.97,-164 138.97,-164 138.97,-164 234.82,-164 234.82,-164 240.82,-164 246.82,-170 246.82,-176 246.82,-176 246.82,-215.6 246.82,-215.6 246.82,-221.6 240.82,-227.6 234.82,-227.6\"/>\n<text text-anchor=\"start\" x=\"137.77\" y=\"-204.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">spend_std_dev</text>\n<text text-anchor=\"start\" x=\"174.15\" y=\"-176.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">float</text>\n</g>\n<!-- spend_zero_mean_unit_variance -->\n<g id=\"node5\" class=\"node\">\n<title>spend_zero_mean_unit_variance</title>\n<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M707.65,-279.6C707.65,-279.6 497.05,-279.6 497.05,-279.6 491.05,-279.6 485.05,-273.6 485.05,-267.6 485.05,-267.6 485.05,-228 485.05,-228 485.05,-222 491.05,-216 497.05,-216 497.05,-216 707.65,-216 707.65,-216 713.65,-216 719.65,-222 719.65,-228 719.65,-228 719.65,-267.6 719.65,-267.6 719.65,-273.6 713.65,-279.6 707.65,-279.6\"/>\n<text text-anchor=\"start\" x=\"495.85\" y=\"-256.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">spend_zero_mean_unit_variance</text>\n<text text-anchor=\"start\" x=\"583.22\" y=\"-228.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Series</text>\n</g>\n<!-- spend_std_dev&#45;&gt;spend_zero_mean_unit_variance -->\n<g id=\"edge5\" class=\"edge\">\n<title>spend_std_dev&#45;&gt;spend_zero_mean_unit_variance</title>\n<path fill=\"none\" stroke=\"black\" d=\"M247.14,-203.25C306.1,-210.67 398.47,-222.28 474.1,-231.8\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"473.3,-235.35 483.66,-233.12 474.17,-228.4 473.3,-235.35\"/>\n</g>\n<!-- avg_3wk_spend -->\n<g id=\"node3\" class=\"node\">\n<title>avg_3wk_spend</title>\n<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M237.82,-145.6C237.82,-145.6 135.97,-145.6 135.97,-145.6 129.97,-145.6 123.97,-139.6 123.97,-133.6 123.97,-133.6 123.97,-94 123.97,-94 123.97,-88 129.97,-82 135.97,-82 135.97,-82 237.82,-82 237.82,-82 243.82,-82 249.82,-88 249.82,-94 249.82,-94 249.82,-133.6 249.82,-133.6 249.82,-139.6 243.82,-145.6 237.82,-145.6\"/>\n<text text-anchor=\"start\" x=\"134.77\" y=\"-122.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">avg_3wk_spend</text>\n<text text-anchor=\"start\" x=\"167.77\" y=\"-94.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Series</text>\n</g>\n<!-- spend -->\n<g id=\"node4\" class=\"node\">\n<title>spend</title>\n<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M69.1,-227.6C69.1,-227.6 31.75,-227.6 31.75,-227.6 25.75,-227.6 19.75,-221.6 19.75,-215.6 19.75,-215.6 19.75,-176 19.75,-176 19.75,-170 25.75,-164 31.75,-164 31.75,-164 69.1,-164 69.1,-164 75.1,-164 81.1,-170 81.1,-176 81.1,-176 81.1,-215.6 81.1,-215.6 81.1,-221.6 75.1,-227.6 69.1,-227.6\"/>\n<text text-anchor=\"start\" x=\"30.55\" y=\"-204.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">spend</text>\n<text text-anchor=\"start\" x=\"31.3\" y=\"-176.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Series</text>\n</g>\n<!-- spend&#45;&gt;spend_mean -->\n<g id=\"edge1\" class=\"edge\">\n<title>spend&#45;&gt;spend_mean</title>\n<path fill=\"none\" stroke=\"black\" d=\"M81.56,-215.2C92.4,-222.1 104.75,-229.87 116.1,-236.8 119.04,-238.59 122.05,-240.42 125.11,-242.26\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"122.94,-245.64 133.32,-247.77 126.54,-239.63 122.94,-245.64\"/>\n</g>\n<!-- spend&#45;&gt;spend_std_dev -->\n<g id=\"edge2\" class=\"edge\">\n<title>spend&#45;&gt;spend_std_dev</title>\n<path fill=\"none\" stroke=\"black\" d=\"M81.27,-195.8C91.62,-195.8 103.71,-195.8 115.92,-195.8\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"115.64,-199.3 125.64,-195.8 115.64,-192.3 115.64,-199.3\"/>\n</g>\n<!-- spend&#45;&gt;avg_3wk_spend -->\n<g id=\"edge3\" class=\"edge\">\n<title>spend&#45;&gt;avg_3wk_spend</title>\n<path fill=\"none\" stroke=\"black\" d=\"M81.56,-176.4C92.4,-169.5 104.75,-161.73 116.1,-154.8 117.85,-153.73 119.64,-152.65 121.44,-151.56\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"122.78,-154.23 129.55,-146.08 119.18,-148.23 122.78,-154.23\"/>\n</g>\n<!-- spend_per_signup -->\n<g id=\"node7\" class=\"node\">\n<title>spend_per_signup</title>\n<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M245.7,-63.6C245.7,-63.6 128.1,-63.6 128.1,-63.6 122.1,-63.6 116.1,-57.6 116.1,-51.6 116.1,-51.6 116.1,-12 116.1,-12 116.1,-6 122.1,0 128.1,0 128.1,0 245.7,0 245.7,0 251.7,0 257.7,-6 257.7,-12 257.7,-12 257.7,-51.6 257.7,-51.6 257.7,-57.6 251.7,-63.6 245.7,-63.6\"/>\n<text text-anchor=\"start\" x=\"126.9\" y=\"-40.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">spend_per_signup</text>\n<text text-anchor=\"start\" x=\"167.77\" y=\"-12.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Series</text>\n</g>\n<!-- spend&#45;&gt;spend_per_signup -->\n<g id=\"edge7\" class=\"edge\">\n<title>spend&#45;&gt;spend_per_signup</title>\n<path fill=\"none\" stroke=\"black\" d=\"M62.55,-163.73C73.09,-136.96 91.04,-99.07 116.1,-72.8 116.66,-72.21 117.24,-71.62 117.82,-71.04\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"119.76,-74.11 124.89,-64.84 115.1,-68.89 119.76,-74.11\"/>\n</g>\n<!-- spend&#45;&gt;spend_zero_mean -->\n<g id=\"edge9\" class=\"edge\">\n<title>spend&#45;&gt;spend_zero_mean</title>\n<path fill=\"none\" stroke=\"black\" d=\"M81.31,-219.29C85.64,-223.74 89.7,-228.63 92.85,-233.8 113.25,-267.24 84.97,-295.04 116.1,-318.8 169.08,-359.24 246.56,-338.69 302.06,-314.46\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"303.13,-317.37 310.81,-310.07 300.25,-310.99 303.13,-317.37\"/>\n</g>\n<!-- log_spend_per_signup -->\n<g id=\"node6\" class=\"node\">\n<title>log_spend_per_signup</title>\n<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M444.05,-63.6C444.05,-63.6 298.7,-63.6 298.7,-63.6 292.7,-63.6 286.7,-57.6 286.7,-51.6 286.7,-51.6 286.7,-12 286.7,-12 286.7,-6 292.7,0 298.7,0 298.7,0 444.05,0 444.05,0 450.05,0 456.05,-6 456.05,-12 456.05,-12 456.05,-51.6 456.05,-51.6 456.05,-57.6 450.05,-63.6 444.05,-63.6\"/>\n<text text-anchor=\"start\" x=\"297.5\" y=\"-40.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">log_spend_per_signup</text>\n<text text-anchor=\"start\" x=\"352.25\" y=\"-12.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Series</text>\n</g>\n<!-- spend_per_signup&#45;&gt;log_spend_per_signup -->\n<g id=\"edge6\" class=\"edge\">\n<title>spend_per_signup&#45;&gt;log_spend_per_signup</title>\n<path fill=\"none\" stroke=\"black\" d=\"M258.19,-31.8C263.96,-31.8 269.85,-31.8 275.76,-31.8\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"275.4,-35.3 285.4,-31.8 275.4,-28.3 275.4,-35.3\"/>\n</g>\n<!-- spend_zero_mean&#45;&gt;spend_zero_mean_unit_variance -->\n<g id=\"edge4\" class=\"edge\">\n<title>spend_zero_mean&#45;&gt;spend_zero_mean_unit_variance</title>\n<path fill=\"none\" stroke=\"black\" d=\"M441.7,-268.72C452.07,-267.36 463.03,-265.92 474.16,-264.46\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"474.4,-267.83 483.86,-263.06 473.49,-260.89 474.4,-267.83\"/>\n</g>\n<!-- signups -->\n<g id=\"node9\" class=\"node\">\n<title>signups</title>\n<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M75.1,-63.6C75.1,-63.6 25.75,-63.6 25.75,-63.6 19.75,-63.6 13.75,-57.6 13.75,-51.6 13.75,-51.6 13.75,-12 13.75,-12 13.75,-6 19.75,0 25.75,0 25.75,0 75.1,0 75.1,0 81.1,0 87.1,-6 87.1,-12 87.1,-12 87.1,-51.6 87.1,-51.6 87.1,-57.6 81.1,-63.6 75.1,-63.6\"/>\n<text text-anchor=\"start\" x=\"24.55\" y=\"-40.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">signups</text>\n<text text-anchor=\"start\" x=\"31.3\" y=\"-12.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Series</text>\n</g>\n<!-- signups&#45;&gt;spend_per_signup -->\n<g id=\"edge8\" class=\"edge\">\n<title>signups&#45;&gt;spend_per_signup</title>\n<path fill=\"none\" stroke=\"black\" d=\"M87.46,-31.8C92.96,-31.8 98.81,-31.8 104.81,-31.8\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"104.75,-35.3 114.75,-31.8 104.75,-28.3 104.75,-35.3\"/>\n</g>\n<!-- function -->\n<g id=\"node10\" class=\"node\">\n<title>function</title>\n<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M72.85,-282.1C72.85,-282.1 28,-282.1 28,-282.1 22,-282.1 16,-276.1 16,-270.1 16,-270.1 16,-257.5 16,-257.5 16,-251.5 22,-245.5 28,-245.5 28,-245.5 72.85,-245.5 72.85,-245.5 78.85,-245.5 84.85,-251.5 84.85,-257.5 84.85,-257.5 84.85,-270.1 84.85,-270.1 84.85,-276.1 78.85,-282.1 72.85,-282.1\"/>\n<text text-anchor=\"middle\" x=\"50.42\" y=\"-258\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">function</text>\n</g>\n</g>\n</svg>\n",
"text/plain": "<graphviz.graphs.Digraph at 0x142ce6610>"
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Cell 5 - visualize execution\n",
"# To visualize do `pip install \"sf-hamilton[visualization]\"` if you want these to work\n",
"\n",
"# visualize all possible functions\n",
"dr.display_all_functions() # no args needed for jupyter"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"pycharm": {
"name": "#%%\n"
},
"ExecuteTime": {
"end_time": "2023-11-08T00:06:18.639068Z",
"start_time": "2023-11-08T00:06:18.070616Z"
}
},
"outputs": [
{
"data": {
"image/svg+xml": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<!-- Generated by graphviz version 8.0.5 (20230430.1635)\n -->\n<!-- Pages: 1 -->\n<svg width=\"698pt\" height=\"362pt\"\n viewBox=\"0.00 0.00 698.40 361.80\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 357.8)\">\n<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-357.8 694.4,-357.8 694.4,4 -4,4\"/>\n<g id=\"clust1\" class=\"cluster\">\n<title>cluster__legend</title>\n<polygon fill=\"none\" stroke=\"black\" points=\"8,-215.8 8,-345.8 92.85,-345.8 92.85,-215.8 8,-215.8\"/>\n<text text-anchor=\"middle\" x=\"50.42\" y=\"-328.5\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">Legend</text>\n</g>\n<!-- spend_mean -->\n<g id=\"node1\" class=\"node\">\n<title>spend_mean</title>\n<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M227.32,-347.6C227.32,-347.6 146.47,-347.6 146.47,-347.6 140.47,-347.6 134.47,-341.6 134.47,-335.6 134.47,-335.6 134.47,-296 134.47,-296 134.47,-290 140.47,-284 146.47,-284 146.47,-284 227.32,-284 227.32,-284 233.32,-284 239.32,-290 239.32,-296 239.32,-296 239.32,-335.6 239.32,-335.6 239.32,-341.6 233.32,-347.6 227.32,-347.6\"/>\n<text text-anchor=\"start\" x=\"145.27\" y=\"-324.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">spend_mean</text>\n<text text-anchor=\"start\" x=\"174.15\" y=\"-296.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">float</text>\n</g>\n<!-- spend_zero_mean -->\n<g id=\"node7\" class=\"node\">\n<title>spend_zero_mean</title>\n<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M414.8,-205.6C414.8,-205.6 298.7,-205.6 298.7,-205.6 292.7,-205.6 286.7,-199.6 286.7,-193.6 286.7,-193.6 286.7,-154 286.7,-154 286.7,-148 292.7,-142 298.7,-142 298.7,-142 414.8,-142 414.8,-142 420.8,-142 426.8,-148 426.8,-154 426.8,-154 426.8,-193.6 426.8,-193.6 426.8,-199.6 420.8,-205.6 414.8,-205.6\"/>\n<text text-anchor=\"start\" x=\"297.5\" y=\"-182.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">spend_zero_mean</text>\n<text text-anchor=\"start\" x=\"337.62\" y=\"-154.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Series</text>\n</g>\n<!-- spend_mean&#45;&gt;spend_zero_mean -->\n<g id=\"edge9\" class=\"edge\">\n<title>spend_mean&#45;&gt;spend_zero_mean</title>\n<path fill=\"none\" stroke=\"black\" d=\"M239.65,-287.55C245.9,-283.52 252.06,-279.23 257.7,-274.8 280.57,-256.84 303.37,-233.75 321.21,-214.19\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"323.46,-216.82 327.55,-207.04 318.25,-212.13 323.46,-216.82\"/>\n</g>\n<!-- spend -->\n<g id=\"node2\" class=\"node\">\n<title>spend</title>\n<path fill=\"#ffc857\" stroke=\"black\" d=\"M69.1,-205.6C69.1,-205.6 31.75,-205.6 31.75,-205.6 25.75,-205.6 19.75,-199.6 19.75,-193.6 19.75,-193.6 19.75,-154 19.75,-154 19.75,-148 25.75,-142 31.75,-142 31.75,-142 69.1,-142 69.1,-142 75.1,-142 81.1,-148 81.1,-154 81.1,-154 81.1,-193.6 81.1,-193.6 81.1,-199.6 75.1,-205.6 69.1,-205.6\"/>\n<text text-anchor=\"start\" x=\"30.55\" y=\"-182.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">spend</text>\n<text text-anchor=\"start\" x=\"31.3\" y=\"-154.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Series</text>\n</g>\n<!-- spend&#45;&gt;spend_mean -->\n<g id=\"edge1\" class=\"edge\">\n<title>spend&#45;&gt;spend_mean</title>\n<path fill=\"none\" stroke=\"black\" d=\"M81.35,-197.97C85.58,-202.27 89.59,-206.94 92.85,-211.8 109.48,-236.58 96.95,-251.91 116.1,-274.8 118.99,-278.26 122.25,-281.49 125.75,-284.5\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"123.22,-287.75 133.26,-291.13 127.52,-282.22 123.22,-287.75\"/>\n</g>\n<!-- avg_3wk_spend -->\n<g id=\"node3\" class=\"node\">\n<title>avg_3wk_spend</title>\n<path fill=\"#ffc857\" stroke=\"black\" d=\"M237.82,-265.6C237.82,-265.6 135.97,-265.6 135.97,-265.6 129.97,-265.6 123.97,-259.6 123.97,-253.6 123.97,-253.6 123.97,-214 123.97,-214 123.97,-208 129.97,-202 135.97,-202 135.97,-202 237.82,-202 237.82,-202 243.82,-202 249.82,-208 249.82,-214 249.82,-214 249.82,-253.6 249.82,-253.6 249.82,-259.6 243.82,-265.6 237.82,-265.6\"/>\n<text text-anchor=\"start\" x=\"134.77\" y=\"-242.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">avg_3wk_spend</text>\n<text text-anchor=\"start\" x=\"167.77\" y=\"-214.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Series</text>\n</g>\n<!-- spend&#45;&gt;avg_3wk_spend -->\n<g id=\"edge2\" class=\"edge\">\n<title>spend&#45;&gt;avg_3wk_spend</title>\n<path fill=\"none\" stroke=\"black\" d=\"M81.27,-187.12C91.06,-191.49 102.41,-196.55 113.94,-201.69\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"112.08,-205.14 122.64,-206.02 114.93,-198.75 112.08,-205.14\"/>\n</g>\n<!-- spend_std_dev -->\n<g id=\"node4\" class=\"node\">\n<title>spend_std_dev</title>\n<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M234.82,-145.6C234.82,-145.6 138.97,-145.6 138.97,-145.6 132.97,-145.6 126.97,-139.6 126.97,-133.6 126.97,-133.6 126.97,-94 126.97,-94 126.97,-88 132.97,-82 138.97,-82 138.97,-82 234.82,-82 234.82,-82 240.82,-82 246.82,-88 246.82,-94 246.82,-94 246.82,-133.6 246.82,-133.6 246.82,-139.6 240.82,-145.6 234.82,-145.6\"/>\n<text text-anchor=\"start\" x=\"137.77\" y=\"-122.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">spend_std_dev</text>\n<text text-anchor=\"start\" x=\"174.15\" y=\"-94.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">float</text>\n</g>\n<!-- spend&#45;&gt;spend_std_dev -->\n<g id=\"edge3\" class=\"edge\">\n<title>spend&#45;&gt;spend_std_dev</title>\n<path fill=\"none\" stroke=\"black\" d=\"M81.27,-160.48C91.83,-155.77 104.2,-150.25 116.66,-144.69\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"117.93,-147.51 125.64,-140.24 115.08,-141.12 117.93,-147.51\"/>\n</g>\n<!-- spend_per_signup -->\n<g id=\"node6\" class=\"node\">\n<title>spend_per_signup</title>\n<path fill=\"#ffc857\" stroke=\"black\" d=\"M245.7,-63.6C245.7,-63.6 128.1,-63.6 128.1,-63.6 122.1,-63.6 116.1,-57.6 116.1,-51.6 116.1,-51.6 116.1,-12 116.1,-12 116.1,-6 122.1,0 128.1,0 128.1,0 245.7,0 245.7,0 251.7,0 257.7,-6 257.7,-12 257.7,-12 257.7,-51.6 257.7,-51.6 257.7,-57.6 251.7,-63.6 245.7,-63.6\"/>\n<text text-anchor=\"start\" x=\"126.9\" y=\"-40.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">spend_per_signup</text>\n<text text-anchor=\"start\" x=\"167.77\" y=\"-12.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Series</text>\n</g>\n<!-- spend&#45;&gt;spend_per_signup -->\n<g id=\"edge6\" class=\"edge\">\n<title>spend&#45;&gt;spend_per_signup</title>\n<path fill=\"none\" stroke=\"black\" d=\"M66.78,-141.9C78.22,-120.52 95.4,-92.72 116.1,-72.8 116.81,-72.12 117.53,-71.44 118.27,-70.77\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"120.1,-72.97 125.54,-63.88 115.62,-67.59 120.1,-72.97\"/>\n</g>\n<!-- spend&#45;&gt;spend_zero_mean -->\n<g id=\"edge8\" class=\"edge\">\n<title>spend&#45;&gt;spend_zero_mean</title>\n<path fill=\"none\" stroke=\"black\" d=\"M81.44,-173.8C126.16,-173.8 211.86,-173.8 275.62,-173.8\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"275.46,-177.3 285.46,-173.8 275.46,-170.3 275.46,-177.3\"/>\n</g>\n<!-- spend_zero_mean_unit_variance -->\n<g id=\"node5\" class=\"node\">\n<title>spend_zero_mean_unit_variance</title>\n<path fill=\"#ffc857\" stroke=\"black\" d=\"M678.4,-175.6C678.4,-175.6 467.8,-175.6 467.8,-175.6 461.8,-175.6 455.8,-169.6 455.8,-163.6 455.8,-163.6 455.8,-124 455.8,-124 455.8,-118 461.8,-112 467.8,-112 467.8,-112 678.4,-112 678.4,-112 684.4,-112 690.4,-118 690.4,-124 690.4,-124 690.4,-163.6 690.4,-163.6 690.4,-169.6 684.4,-175.6 678.4,-175.6\"/>\n<text text-anchor=\"start\" x=\"466.6\" y=\"-152.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">spend_zero_mean_unit_variance</text>\n<text text-anchor=\"start\" x=\"553.97\" y=\"-124.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Series</text>\n</g>\n<!-- spend_std_dev&#45;&gt;spend_zero_mean_unit_variance -->\n<g id=\"edge5\" class=\"edge\">\n<title>spend_std_dev&#45;&gt;spend_zero_mean_unit_variance</title>\n<path fill=\"none\" stroke=\"black\" d=\"M247.09,-118.42C299.64,-122.52 378.21,-128.66 444.94,-133.87\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"444.3,-137.41 454.54,-134.7 444.84,-130.43 444.3,-137.41\"/>\n</g>\n<!-- spend_zero_mean&#45;&gt;spend_zero_mean_unit_variance -->\n<g id=\"edge4\" class=\"edge\">\n<title>spend_zero_mean&#45;&gt;spend_zero_mean_unit_variance</title>\n<path fill=\"none\" stroke=\"black\" d=\"M427.05,-164.1C432.78,-163.3 438.68,-162.47 444.67,-161.64\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"445.1,-164.97 454.52,-160.12 444.13,-158.04 445.1,-164.97\"/>\n</g>\n<!-- signups -->\n<g id=\"node8\" class=\"node\">\n<title>signups</title>\n<path fill=\"#ffc857\" stroke=\"black\" d=\"M75.1,-63.6C75.1,-63.6 25.75,-63.6 25.75,-63.6 19.75,-63.6 13.75,-57.6 13.75,-51.6 13.75,-51.6 13.75,-12 13.75,-12 13.75,-6 19.75,0 25.75,0 25.75,0 75.1,0 75.1,0 81.1,0 87.1,-6 87.1,-12 87.1,-12 87.1,-51.6 87.1,-51.6 87.1,-57.6 81.1,-63.6 75.1,-63.6\"/>\n<text text-anchor=\"start\" x=\"24.55\" y=\"-40.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">signups</text>\n<text text-anchor=\"start\" x=\"31.3\" y=\"-12.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Series</text>\n</g>\n<!-- signups&#45;&gt;spend_per_signup -->\n<g id=\"edge7\" class=\"edge\">\n<title>signups&#45;&gt;spend_per_signup</title>\n<path fill=\"none\" stroke=\"black\" d=\"M87.46,-31.8C92.96,-31.8 98.81,-31.8 104.81,-31.8\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"104.75,-35.3 114.75,-31.8 104.75,-28.3 104.75,-35.3\"/>\n</g>\n<!-- function -->\n<g id=\"node9\" class=\"node\">\n<title>function</title>\n<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M72.85,-315.1C72.85,-315.1 28,-315.1 28,-315.1 22,-315.1 16,-309.1 16,-303.1 16,-303.1 16,-290.5 16,-290.5 16,-284.5 22,-278.5 28,-278.5 28,-278.5 72.85,-278.5 72.85,-278.5 78.85,-278.5 84.85,-284.5 84.85,-290.5 84.85,-290.5 84.85,-303.1 84.85,-303.1 84.85,-309.1 78.85,-315.1 72.85,-315.1\"/>\n<text text-anchor=\"middle\" x=\"50.42\" y=\"-291\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">function</text>\n</g>\n<!-- output -->\n<g id=\"node10\" class=\"node\">\n<title>output</title>\n<path fill=\"#ffc857\" stroke=\"black\" d=\"M67.97,-260.1C67.97,-260.1 32.87,-260.1 32.87,-260.1 26.87,-260.1 20.87,-254.1 20.87,-248.1 20.87,-248.1 20.87,-235.5 20.87,-235.5 20.87,-229.5 26.87,-223.5 32.87,-223.5 32.87,-223.5 67.97,-223.5 67.97,-223.5 73.97,-223.5 79.97,-229.5 79.97,-235.5 79.97,-235.5 79.97,-248.1 79.97,-248.1 79.97,-254.1 73.97,-260.1 67.97,-260.1\"/>\n<text text-anchor=\"middle\" x=\"50.42\" y=\"-236\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">output</text>\n</g>\n</g>\n</svg>\n",
"text/plain": "<graphviz.graphs.Digraph at 0x142ce6460>"
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# visualize just the execution path\n",
"dr.visualize_execution(output_columns) # no other args needed for jupyter"
]
},
{
"cell_type": "code",
"execution_count": 7,
"outputs": [
{
"data": {
"image/svg+xml": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<!-- Generated by graphviz version 8.0.5 (20230430.1635)\n -->\n<!-- Pages: 1 -->\n<svg width=\"674pt\" height=\"225pt\"\n viewBox=\"0.00 0.00 674.40 224.80\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 220.8)\">\n<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-220.8 670.4,-220.8 670.4,4 -4,4\"/>\n<g id=\"clust1\" class=\"cluster\">\n<title>cluster__legend</title>\n<polygon fill=\"none\" stroke=\"black\" points=\"8,-133.8 8,-208.8 92.85,-208.8 92.85,-133.8 8,-133.8\"/>\n<text text-anchor=\"middle\" x=\"50.42\" y=\"-191.5\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">Legend</text>\n</g>\n<!-- spend_mean -->\n<g id=\"node1\" class=\"node\">\n<title>spend_mean</title>\n<path fill=\"#b4d8e4\" stroke=\"red\" d=\"M214.2,-183.6C214.2,-183.6 133.35,-183.6 133.35,-183.6 127.35,-183.6 121.35,-177.6 121.35,-171.6 121.35,-171.6 121.35,-132 121.35,-132 121.35,-126 127.35,-120 133.35,-120 133.35,-120 214.2,-120 214.2,-120 220.2,-120 226.2,-126 226.2,-132 226.2,-132 226.2,-171.6 226.2,-171.6 226.2,-177.6 220.2,-183.6 214.2,-183.6\"/>\n<text text-anchor=\"start\" x=\"132.15\" y=\"-160.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">spend_mean</text>\n<text text-anchor=\"start\" x=\"161.02\" y=\"-132.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">float</text>\n</g>\n<!-- spend_zero_mean -->\n<g id=\"node5\" class=\"node\">\n<title>spend_zero_mean</title>\n<path fill=\"#b4d8e4\" stroke=\"red\" d=\"M390.8,-123.6C390.8,-123.6 274.7,-123.6 274.7,-123.6 268.7,-123.6 262.7,-117.6 262.7,-111.6 262.7,-111.6 262.7,-72 262.7,-72 262.7,-66 268.7,-60 274.7,-60 274.7,-60 390.8,-60 390.8,-60 396.8,-60 402.8,-66 402.8,-72 402.8,-72 402.8,-111.6 402.8,-111.6 402.8,-117.6 396.8,-123.6 390.8,-123.6\"/>\n<text text-anchor=\"start\" x=\"273.5\" y=\"-100.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">spend_zero_mean</text>\n<text text-anchor=\"start\" x=\"313.62\" y=\"-72.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Series</text>\n</g>\n<!-- spend_mean&#45;&gt;spend_zero_mean -->\n<g id=\"edge6\" class=\"edge\">\n<title>spend_mean&#45;&gt;spend_zero_mean</title>\n<path fill=\"none\" stroke=\"red\" d=\"M226.61,-131.99C234.83,-128.85 243.48,-125.54 252.16,-122.22\"/>\n<polygon fill=\"red\" stroke=\"red\" points=\"253.24,-125.17 261.33,-118.34 250.74,-118.64 253.24,-125.17\"/>\n</g>\n<!-- spend -->\n<g id=\"node2\" class=\"node\">\n<title>spend</title>\n<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M69.1,-123.6C69.1,-123.6 31.75,-123.6 31.75,-123.6 25.75,-123.6 19.75,-117.6 19.75,-111.6 19.75,-111.6 19.75,-72 19.75,-72 19.75,-66 25.75,-60 31.75,-60 31.75,-60 69.1,-60 69.1,-60 75.1,-60 81.1,-66 81.1,-72 81.1,-72 81.1,-111.6 81.1,-111.6 81.1,-117.6 75.1,-123.6 69.1,-123.6\"/>\n<text text-anchor=\"start\" x=\"30.55\" y=\"-100.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">spend</text>\n<text text-anchor=\"start\" x=\"31.3\" y=\"-72.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Series</text>\n</g>\n<!-- spend&#45;&gt;spend_mean -->\n<g id=\"edge1\" class=\"edge\">\n<title>spend&#45;&gt;spend_mean</title>\n<path fill=\"none\" stroke=\"black\" d=\"M81.42,-106.63C90.56,-111.15 100.95,-116.29 111.37,-121.44\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"109.4,-124.87 119.92,-126.16 112.51,-118.59 109.4,-124.87\"/>\n</g>\n<!-- spend_std_dev -->\n<g id=\"node3\" class=\"node\">\n<title>spend_std_dev</title>\n<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M221.7,-63.6C221.7,-63.6 125.85,-63.6 125.85,-63.6 119.85,-63.6 113.85,-57.6 113.85,-51.6 113.85,-51.6 113.85,-12 113.85,-12 113.85,-6 119.85,0 125.85,0 125.85,0 221.7,0 221.7,0 227.7,0 233.7,-6 233.7,-12 233.7,-12 233.7,-51.6 233.7,-51.6 233.7,-57.6 227.7,-63.6 221.7,-63.6\"/>\n<text text-anchor=\"start\" x=\"124.65\" y=\"-40.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">spend_std_dev</text>\n<text text-anchor=\"start\" x=\"161.02\" y=\"-12.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">float</text>\n</g>\n<!-- spend&#45;&gt;spend_std_dev -->\n<g id=\"edge2\" class=\"edge\">\n<title>spend&#45;&gt;spend_std_dev</title>\n<path fill=\"none\" stroke=\"black\" d=\"M81.42,-76.97C88.41,-73.51 96.13,-69.7 104.04,-65.79\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"105.33,-68.56 112.74,-60.99 102.22,-62.28 105.33,-68.56\"/>\n</g>\n<!-- spend&#45;&gt;spend_zero_mean -->\n<g id=\"edge5\" class=\"edge\">\n<title>spend&#45;&gt;spend_zero_mean</title>\n<path fill=\"none\" stroke=\"black\" d=\"M81.42,-91.8C121.7,-91.8 194.75,-91.8 251.58,-91.8\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"251.35,-95.3 261.35,-91.8 251.35,-88.3 251.35,-95.3\"/>\n</g>\n<!-- spend_zero_mean_unit_variance -->\n<g id=\"node4\" class=\"node\">\n<title>spend_zero_mean_unit_variance</title>\n<path fill=\"#b4d8e4\" stroke=\"red\" d=\"M654.4,-93.6C654.4,-93.6 443.8,-93.6 443.8,-93.6 437.8,-93.6 431.8,-87.6 431.8,-81.6 431.8,-81.6 431.8,-42 431.8,-42 431.8,-36 437.8,-30 443.8,-30 443.8,-30 654.4,-30 654.4,-30 660.4,-30 666.4,-36 666.4,-42 666.4,-42 666.4,-81.6 666.4,-81.6 666.4,-87.6 660.4,-93.6 654.4,-93.6\"/>\n<text text-anchor=\"start\" x=\"442.6\" y=\"-70.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">spend_zero_mean_unit_variance</text>\n<text text-anchor=\"start\" x=\"529.97\" y=\"-42.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">Series</text>\n</g>\n<!-- spend_std_dev&#45;&gt;spend_zero_mean_unit_variance -->\n<g id=\"edge4\" class=\"edge\">\n<title>spend_std_dev&#45;&gt;spend_zero_mean_unit_variance</title>\n<path fill=\"none\" stroke=\"black\" d=\"M233.93,-36.55C283.98,-40.58 357.45,-46.48 420.76,-51.57\"/>\n<polygon fill=\"black\" stroke=\"black\" points=\"420.39,-55.13 430.64,-52.44 420.95,-48.15 420.39,-55.13\"/>\n</g>\n<!-- spend_zero_mean&#45;&gt;spend_zero_mean_unit_variance -->\n<g id=\"edge3\" class=\"edge\">\n<title>spend_zero_mean&#45;&gt;spend_zero_mean_unit_variance</title>\n<path fill=\"none\" stroke=\"red\" d=\"M403.05,-82.1C408.78,-81.3 414.68,-80.47 420.67,-79.64\"/>\n<polygon fill=\"red\" stroke=\"red\" points=\"421.1,-82.97 430.52,-78.12 420.13,-76.04 421.1,-82.97\"/>\n</g>\n<!-- function -->\n<g id=\"node6\" class=\"node\">\n<title>function</title>\n<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M72.85,-178.1C72.85,-178.1 28,-178.1 28,-178.1 22,-178.1 16,-172.1 16,-166.1 16,-166.1 16,-153.5 16,-153.5 16,-147.5 22,-141.5 28,-141.5 28,-141.5 72.85,-141.5 72.85,-141.5 78.85,-141.5 84.85,-147.5 84.85,-153.5 84.85,-153.5 84.85,-166.1 84.85,-166.1 84.85,-172.1 78.85,-178.1 72.85,-178.1\"/>\n<text text-anchor=\"middle\" x=\"50.42\" y=\"-154\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">function</text>\n</g>\n</g>\n</svg>\n",
"text/plain": "<graphviz.graphs.Digraph at 0x142ce6ac0>"
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# visualize the path of execution between two functions\n",
"dr.visualize_path_between(\"spend_mean\", \"spend_zero_mean_unit_variance\",\n",
" strict_path_visualization=False)"
],
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2023-11-08T00:06:19.243065Z",
"start_time": "2023-11-08T00:06:18.632623Z"
}
}
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"ExecuteTime": {
"end_time": "2023-11-08T00:06:19.580251Z",
"start_time": "2023-11-08T00:06:19.520006Z"
}
},
"outputs": [
{
"data": {
"text/plain": " spend signups avg_3wk_spend spend_per_signup \\\n0 10 1 NaN 10.000 \n1 10 10 NaN 1.000 \n2 20 50 13.333333 0.400 \n3 40 100 23.333333 0.400 \n4 40 200 33.333333 0.200 \n5 50 400 43.333333 0.125 \n\n spend_zero_mean_unit_variance \n0 -1.064405 \n1 -1.064405 \n2 -0.483821 \n3 0.677349 \n4 0.677349 \n5 1.257934 ",
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>spend</th>\n <th>signups</th>\n <th>avg_3wk_spend</th>\n <th>spend_per_signup</th>\n <th>spend_zero_mean_unit_variance</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>10</td>\n <td>1</td>\n <td>NaN</td>\n <td>10.000</td>\n <td>-1.064405</td>\n </tr>\n <tr>\n <th>1</th>\n <td>10</td>\n <td>10</td>\n <td>NaN</td>\n <td>1.000</td>\n <td>-1.064405</td>\n </tr>\n <tr>\n <th>2</th>\n <td>20</td>\n <td>50</td>\n <td>13.333333</td>\n <td>0.400</td>\n <td>-0.483821</td>\n </tr>\n <tr>\n <th>3</th>\n <td>40</td>\n <td>100</td>\n <td>23.333333</td>\n <td>0.400</td>\n <td>0.677349</td>\n </tr>\n <tr>\n <th>4</th>\n <td>40</td>\n <td>200</td>\n <td>33.333333</td>\n <td>0.200</td>\n <td>0.677349</td>\n </tr>\n <tr>\n <th>5</th>\n <td>50</td>\n <td>400</td>\n <td>43.333333</td>\n <td>0.125</td>\n <td>1.257934</td>\n </tr>\n </tbody>\n</table>\n</div>"
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# let's create the dataframe!\n",
"dr.execute(output_columns)"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"ExecuteTime": {
"end_time": "2023-05-22T22:27:18.053784Z",
"start_time": "2023-05-22T22:27:18.046215Z"
}
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"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.8.13"
}
},
"nbformat": 4,
"nbformat_minor": 1
}