diff --git a/00_intro.ipynb b/00_intro.ipynb index dd32621..1ecaa31 100644 --- a/00_intro.ipynb +++ b/00_intro.ipynb @@ -4,7 +4,10 @@ "cell_type": "markdown", "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "2bb220eb-b4b5-46d8-a9a0-6e6331a01d46", "showTitle": false, @@ -19,7 +22,10 @@ "cell_type": "markdown", "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "92a25ef9-1b17-4f26-a615-ad66f051c1e1", "showTitle": false, @@ -60,7 +66,10 @@ "cell_type": "markdown", "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "3d527009-ad2d-4239-a427-37eabe35a6d6", "showTitle": false, @@ -114,7 +123,10 @@ "cell_type": "markdown", "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "500f91de-740e-4cc9-b63b-2f81a77a9899", "showTitle": false, @@ -134,7 +146,10 @@ "execution_count": 0, "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "7074a071-e301-4043-9d1d-2a90ee4f95e5", "showTitle": true, @@ -151,7 +166,10 @@ "execution_count": 0, "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "195ac730-282a-43a9-9e60-04f0ac322c19", "showTitle": true, @@ -171,7 +189,10 @@ "cell_type": "markdown", "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "4f30d5af-d4a0-4191-8d73-c7b4f52f15f6", "showTitle": false, @@ -209,7 +230,10 @@ "execution_count": 0, "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "3f16324b-38db-4c66-8eda-32bf209db06b", "showTitle": true, @@ -228,7 +252,10 @@ "cell_type": "markdown", "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "ad77ecd0-6ee3-4d25-8940-872490e6726a", "showTitle": false, @@ -246,7 +273,10 @@ "execution_count": 0, "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "eea443a9-4080-44cc-96cc-161d579b970e", "showTitle": true, @@ -262,7 +292,10 @@ "cell_type": "markdown", "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "0ffc2283-43d0-4444-91a7-9108753aa370", "showTitle": false, @@ -280,7 +313,10 @@ "execution_count": 0, "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "683c13aa-0615-4a7e-b131-aa6754fb48df", "showTitle": true, @@ -300,7 +336,10 @@ "cell_type": "markdown", "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "8bef3897-24b1-48c2-b944-bf2054bcecf7", "showTitle": false, @@ -315,7 +354,10 @@ "cell_type": "markdown", "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "40f7a244-6869-49ca-9d90-92c071fe2c1b", "showTitle": false, @@ -333,7 +375,10 @@ "execution_count": 0, "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "68e88377-88ed-40a2-b435-e559d6d7af44", "showTitle": true, @@ -351,7 +396,10 @@ "cell_type": "markdown", "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "15f56bdb-4beb-4fe6-9a61-a495da7d5dc3", "showTitle": false, @@ -368,7 +416,10 @@ "cell_type": "markdown", "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "32ad0039-f35e-4686-ad50-87dfaf65db1c", "showTitle": false, @@ -395,7 +446,10 @@ "cell_type": "markdown", "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "6541a350-62cf-4f12-ae86-2a0bf0789829", "showTitle": false, @@ -410,7 +464,10 @@ "cell_type": "markdown", "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "401f0dcc-4f88-4a51-a339-979af7c8cf1c", "showTitle": false, @@ -431,6 +488,7 @@ "metadata": { "application/vnd.databricks.v1+notebook": { "dashboards": [], + "environmentMetadata": null, "language": "python", "notebookMetadata": { "pythonIndentUnit": 2 diff --git a/01_causal_discovery.ipynb b/01_causal_discovery.ipynb index 674ca43..ec47945 100644 --- a/01_causal_discovery.ipynb +++ b/01_causal_discovery.ipynb @@ -4,7 +4,10 @@ "cell_type": "markdown", "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "c0be0376-f008-4fb8-8ca5-cd67241d7ec5", "showTitle": false, @@ -20,7 +23,53 @@ "execution_count": 0, "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, + "inputWidgets": {}, + "nuid": "60f2f5e1-6ae9-4eea-b39d-8275fdc66a76", + "showTitle": false, + "title": "" + } + }, + "outputs": [], + "source": [ + "%sh \n", + "sudo apt-get -qq update\n", + "sudo apt-get -y -qq install graphviz libgraphviz-dev" + ] + }, + { + "cell_type": "code", + "execution_count": 0, + "metadata": { + "application/vnd.databricks.v1+cell": { + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, + "inputWidgets": {}, + "nuid": "61a0f224-8195-4c8c-82c5-c273e0d7ee9b", + "showTitle": true, + "title": "Install a library for visualization" + } + }, + "outputs": [], + "source": [ + "%pip install pygraphviz==1.10 --quiet\n", + "dbutils.library.restartPython()" + ] + }, + { + "cell_type": "code", + "execution_count": 0, + "metadata": { + "application/vnd.databricks.v1+cell": { + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "d2f6fd8a-0cb6-44ef-9312-8d6d27403d5a", "showTitle": false, @@ -36,7 +85,10 @@ "cell_type": "markdown", "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "8be398d8-971b-4f43-a35d-782ad8eb618e", "showTitle": false, @@ -54,7 +106,10 @@ "execution_count": 0, "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "539c43b9-846f-498b-807e-dd0864091d6b", "showTitle": false, @@ -93,7 +148,10 @@ "cell_type": "markdown", "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "5fb82a8b-4352-43fe-966a-60d7a7160458", "showTitle": false, @@ -113,7 +171,10 @@ "cell_type": "markdown", "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "04e61f57-7fdf-4467-b6d8-fad10dcc3024", "showTitle": false, @@ -128,7 +189,10 @@ "cell_type": "markdown", "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "3d04da71-222a-4869-91e6-13a713ac1d99", "showTitle": false, @@ -150,7 +214,10 @@ "execution_count": 0, "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "bcfe02e4-3fae-426d-a738-73d5835920d0", "showTitle": false, @@ -178,7 +245,10 @@ "cell_type": "markdown", "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "5991b566-77f8-440d-b5cd-23ec2fcde25c", "showTitle": false, @@ -197,7 +267,10 @@ "execution_count": 0, "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "910811fe-3f44-4c5f-b779-d81e013a983a", "showTitle": false, @@ -223,7 +296,10 @@ "cell_type": "markdown", "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "b05c4958-c7d6-45e8-bc6c-7868cea8fd3f", "showTitle": false, @@ -239,7 +315,10 @@ "execution_count": 0, "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "662f9d42-276e-4c09-b27d-6504c0bb1ba3", "showTitle": false, @@ -266,7 +345,10 @@ "cell_type": "markdown", "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "dbc21d42-1b38-446b-ac49-888c69a40829", "showTitle": false, @@ -282,7 +364,10 @@ "execution_count": 0, "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "2795b8e8-75c0-41d8-b7b4-84a366cd6df7", "showTitle": false, @@ -314,7 +399,10 @@ "cell_type": "markdown", "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "7fc7ea1a-21ff-483f-8b1c-05a312df0022", "showTitle": false, @@ -332,7 +420,10 @@ "execution_count": 0, "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "7ef03eaa-5715-4bc7-967b-b9a52baae38d", "showTitle": false, @@ -372,7 +463,10 @@ "cell_type": "markdown", "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "eb6f6fd0-d18c-4aa6-9e01-00e6760e74e6", "showTitle": false, @@ -393,8 +487,15 @@ "metadata": { "application/vnd.databricks.v1+notebook": { "dashboards": [], + "environmentMetadata": null, "language": "python", "notebookMetadata": { + "mostRecentlyExecutedCommandWithImplicitDF": { + "commandId": 888983575928260, + "dataframes": [ + "_sqldf" + ] + }, "pythonIndentUnit": 2 }, "notebookName": "01_causal_discovery", diff --git a/02_identification_estimation.ipynb b/02_identification_estimation.ipynb index 91b5139..a4daeb0 100644 --- a/02_identification_estimation.ipynb +++ b/02_identification_estimation.ipynb @@ -4,7 +4,10 @@ "cell_type": "markdown", "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "f51698b9-84bb-44bf-bfc5-b8d97b68080a", "showTitle": false, @@ -20,7 +23,10 @@ "execution_count": 0, "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "19b7bbc9-c08a-4a2b-87ac-5069175bfcb6", "showTitle": false, @@ -36,7 +42,10 @@ "cell_type": "markdown", "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "270d5fe1-fa4d-4774-b9d9-e003abae1ab1", "showTitle": false, @@ -51,7 +60,10 @@ "cell_type": "markdown", "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "f0607752-b4d8-4ec8-93d8-ce0bd7a2ea59", "showTitle": false, @@ -69,7 +81,10 @@ "execution_count": 0, "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "a5ba81e1-2a9d-4515-a41c-d0e147267a6d", "showTitle": false, @@ -85,7 +100,10 @@ "cell_type": "markdown", "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "4f64fdf2-ea9e-4f3e-8310-7653dee1d10a", "showTitle": false, @@ -101,7 +119,10 @@ "execution_count": 0, "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "06921b02-d3e2-455f-af01-a919dbaf18d6", "showTitle": false, @@ -131,7 +152,10 @@ "cell_type": "markdown", "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "cdd8d10c-7102-42e0-9c7b-f6594eb52020", "showTitle": false, @@ -146,7 +170,10 @@ "cell_type": "markdown", "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "2afe3068-7875-4b22-a724-0e0bfc5a4eda", "showTitle": false, @@ -164,7 +191,10 @@ "execution_count": 0, "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "26e4e3f5-8c38-45b7-9a7b-cee6970447d9", "showTitle": false, @@ -210,7 +240,10 @@ "cell_type": "markdown", "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "86a7b8e8-b634-44d2-b17f-a58973ae3595", "showTitle": false, @@ -227,7 +260,10 @@ "execution_count": 0, "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "20ca3b6d-731d-4840-8c29-9e5126e62db3", "showTitle": false, @@ -237,7 +273,7 @@ "outputs": [], "source": [ "model_details = register_dowhy_model(\n", - " model_name=\"tech_support_total_effect_dowhy_model\",\n", + " model_name=f\"{catalog}.{db}.tech_support_total_effect_dowhy_model\",\n", " model=tech_support_effect_model,\n", " estimand=tech_support_total_effect_identified_estimand,\n", " estimate=tech_support_total_effect_estimate,\n", @@ -248,7 +284,10 @@ "cell_type": "markdown", "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "9a9b6c67-7a78-45e3-999d-c56bf4de97b8", "showTitle": false, @@ -266,7 +305,10 @@ "execution_count": 0, "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "440e4943-d277-420b-a0a7-93417879be0c", "showTitle": false, @@ -288,7 +330,10 @@ "cell_type": "markdown", "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "b464cd92-a05f-4e6e-a6e4-84944eba7b03", "showTitle": false, @@ -304,7 +349,10 @@ "execution_count": 0, "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "923607d7-b98c-469e-836b-505502108f74", "showTitle": false, @@ -342,7 +390,10 @@ "cell_type": "markdown", "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "95152568-5e08-4a38-b878-0c29746fc06b", "showTitle": false, @@ -358,7 +409,10 @@ "execution_count": 0, "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "e681358f-ce1b-4a57-a00d-51826f184195", "showTitle": false, @@ -368,7 +422,7 @@ "outputs": [], "source": [ "model_details = register_dowhy_model(\n", - " model_name=\"tech_support_direct_effect_dowhy_model\",\n", + " model_name=f\"{catalog}.{db}.tech_support_direct_effect_dowhy_model\",\n", " model=tech_support_effect_model,\n", " estimand=tech_support_direct_effect_identified_estimand,\n", " estimate=tech_support_direct_effect_estimate,\n", @@ -379,7 +433,10 @@ "cell_type": "markdown", "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "edb0944a-5523-4308-803f-bcc8146c19ca", "showTitle": false, @@ -397,7 +454,10 @@ "execution_count": 0, "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "fe3a2163-841b-4166-a119-2ce485d91538", "showTitle": false, @@ -423,7 +483,10 @@ "execution_count": 0, "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "2c909cb2-2577-481e-badb-0683f987ca5d", "showTitle": false, @@ -463,7 +526,10 @@ "execution_count": 0, "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "0f17cddd-3978-49fb-a13e-beaa397793d8", "showTitle": false, @@ -473,7 +539,7 @@ "outputs": [], "source": [ "model_details = register_dowhy_model(\n", - " model_name=\"discount_dowhy_model\",\n", + " model_name=f\"{catalog}.{db}.discount_dowhy_model\",\n", " model=discount_effect_model,\n", " estimand=discount_effect_identified_estimand,\n", " estimate=discount_effect_estimate,\n", @@ -484,7 +550,10 @@ "cell_type": "markdown", "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "5b52b2d6-7047-4544-bec4-d12ddccaa5d8", "showTitle": false, @@ -502,7 +571,10 @@ "execution_count": 0, "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "8daac7f0-1286-45ce-aef5-3ea506e9ac42", "showTitle": false, @@ -527,7 +599,10 @@ "execution_count": 0, "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "8226a19b-8575-49cc-ae9a-bad7e92cfed4", "showTitle": false, @@ -551,7 +626,10 @@ "cell_type": "markdown", "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "9373cd46-22ca-4b83-8a46-c3df70768340", "showTitle": false, @@ -568,7 +646,10 @@ "cell_type": "markdown", "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "495cfae7-1e55-499a-8013-0aa2378f40b2", "showTitle": false, @@ -586,7 +667,10 @@ "execution_count": 0, "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "dbe3b251-ae2a-4253-bca3-9d31e9870593", "showTitle": false, @@ -619,7 +703,10 @@ "cell_type": "markdown", "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "bf5ea988-f494-4a20-8572-b0e31fc3443e", "showTitle": false, @@ -638,7 +725,10 @@ "cell_type": "markdown", "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "a5a469e8-a40e-4428-8884-dfd9c637c677", "showTitle": false, @@ -659,8 +749,15 @@ "metadata": { "application/vnd.databricks.v1+notebook": { "dashboards": [], + "environmentMetadata": null, "language": "python", "notebookMetadata": { + "mostRecentlyExecutedCommandWithImplicitDF": { + "commandId": 888983575931288, + "dataframes": [ + "_sqldf" + ] + }, "pythonIndentUnit": 2 }, "notebookName": "02_identification_estimation", diff --git a/03_promotional_offer_recommender.ipynb b/03_promotional_offer_recommender.ipynb index dc83ff0..13003df 100644 --- a/03_promotional_offer_recommender.ipynb +++ b/03_promotional_offer_recommender.ipynb @@ -4,7 +4,10 @@ "cell_type": "markdown", "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "1963c485-808e-4e6b-96bd-c10c4033ae99", "showTitle": false, @@ -20,7 +23,10 @@ "execution_count": 0, "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "eb599ae6-4b84-4808-922b-458856a6fa1d", "showTitle": false, @@ -36,7 +42,10 @@ "cell_type": "markdown", "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "3f9a1d4f-6247-4358-bf1a-f79d7f2e3e94", "showTitle": false, @@ -54,7 +63,10 @@ "execution_count": 0, "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "a03e256a-67a4-4e6a-9367-003f6624e916", "showTitle": false, @@ -125,7 +137,10 @@ "cell_type": "markdown", "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "182d5be1-f0fb-417f-bd9c-e8cb8c75440c", "showTitle": false, @@ -145,7 +160,10 @@ "execution_count": 0, "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": {}, + "cellMetadata": { + "byteLimit": 2048000, + "rowLimit": 10000 + }, "inputWidgets": {}, "nuid": "e6204a2c-bc30-46da-9d5e-71adfbff6837", "showTitle": false, @@ -156,45 +174,41 @@ "source": [ "from mlflow.models.signature import infer_signature\n", "\n", - "model_name = \"personalized_policy_recommender\"\n", + "model_name = f\"{catalog}.{db}.personalized_policy_recommender\"\n", "\n", "with mlflow.start_run(run_name=f\"{model_name}_run\") as experiment_run:\n", " #Instantiate a model \n", " personalizedIncentiveRecommender = PersonalizedIncentiveRecommender(\n", " models_dictionary={\n", " \"tech support\": get_registered_wrapped_model_estimator(\n", - " model_name=\"tech_support_total_effect_dowhy_model\"\n", + " model_name=f\"{catalog}.{db}.tech_support_total_effect_dowhy_model\"\n", " ),\n", " \"discount\": get_registered_wrapped_model_estimator(\n", - " model_name=\"discount_dowhy_model\"\n", + " model_name=f\"{catalog}.{db}.discount_dowhy_model\"\n", " ),\n", " },\n", " effect_modifiers=[\"Size\", \"Global Flag\"],\n", " )\n", " #Log the model in MLflow\n", - " mlflow.pyfunc.log_model(\n", + " model_details = mlflow.pyfunc.log_model(\n", " artifact_path=\"model\",\n", " python_model=personalizedIncentiveRecommender,\n", + " registered_model_name=model_name,\n", " signature=infer_signature(\n", - " input_df.drop([\"Tech Support\", \"Discount\", \"New Engagement Strategy\"], axis=1), personalizedIncentiveRecommender.predict({}, input_df)\n", + " input_df.drop([\"Tech Support\", \"Discount\", \"New Engagement Strategy\"], axis=1), \n", + " personalizedIncentiveRecommender.predict({}, input_df)\n", " ),\n", - " )\n", - "\n", - "#Register the model in MLflow\n", - "model_details = mlflow.register_model(\n", - " model_uri=f\"runs:/{experiment_run.info.run_id}/model\",\n", - " name=model_name,\n", - ")\n", - "\n", - "displayHTML(f\"