From 6cd2985bdd8ed1535e77fa4bb51a2e1f02d62d36 Mon Sep 17 00:00:00 2001 From: Jayesh Sharma Date: Fri, 10 Mar 2023 17:27:11 +0530 Subject: [PATCH] update evidently (#25) * update evidently * clear all outputs * include config and select outputs * select outputs --- 3-1_Data_Skew.ipynb | 120 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 100 insertions(+), 20 deletions(-) diff --git a/3-1_Data_Skew.ipynb b/3-1_Data_Skew.ipynb index a9c6a6b..61352aa 100644 --- a/3-1_Data_Skew.ipynb +++ b/3-1_Data_Skew.ipynb @@ -28,7 +28,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "metadata": {}, "outputs": [], "source": [ @@ -46,7 +46,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ @@ -84,7 +84,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "metadata": {}, "outputs": [], "source": [ @@ -95,7 +95,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "metadata": {}, "outputs": [], "source": [ @@ -127,18 +127,19 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "from zenml.integrations.evidently.steps import (\n", - " EvidentlyProfileParameters,\n", - " evidently_profile_step,\n", + " EvidentlyReportParameters,\n", + " evidently_report_step,\n", ")\n", + "from zenml.integrations.evidently.metrics import EvidentlyMetricConfig\n", "\n", "# configure the Evidently step\n", - "evidently_profile_params = EvidentlyProfileParameters(\n", - " profile_sections=[\"datadrift\"]\n", + "evidently_report_params = EvidentlyReportParameters(\n", + " metrics=[EvidentlyMetricConfig.metric(\"DatasetDriftMetric\")],\n", ")" ] }, @@ -151,7 +152,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "metadata": {}, "outputs": [], "source": [ @@ -181,7 +182,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "metadata": {}, "outputs": [], "source": [ @@ -199,18 +200,39 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 8, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\u001b[1;35mRunning unlisted pipeline on stack \u001b[0m\u001b[33mevidently_stack\u001b[1;35m (caching disabled)\u001b[0m\n", + "\u001b[1;35mStep \u001b[0m\u001b[33mimporter\u001b[1;35m has started.\u001b[0m\n", + "\u001b[1;35mStep \u001b[0m\u001b[33mimporter\u001b[1;35m has finished in 0.518s.\u001b[0m\n", + "\u001b[1;35mStep \u001b[0m\u001b[33mget_reference_data\u001b[1;35m has started.\u001b[0m\n", + "\u001b[1;35mStep \u001b[0m\u001b[33mget_reference_data\u001b[1;35m has finished in 0.396s.\u001b[0m\n", + "\u001b[1;35mStep \u001b[0m\u001b[33mtrainer\u001b[1;35m has started.\u001b[0m\n", + "\u001b[1;35mStep \u001b[0m\u001b[33mtrainer\u001b[1;35m has finished in 0.129s.\u001b[0m\n", + "\u001b[1;35mStep \u001b[0m\u001b[33mevaluator\u001b[1;35m has started.\u001b[0m\n", + "Test accuracy: 0.9583333333333334\n", + "\u001b[1;35mStep \u001b[0m\u001b[33mevaluator\u001b[1;35m has finished in 0.118s.\u001b[0m\n", + "\u001b[1;35mStep \u001b[0m\u001b[33mskew_detector\u001b[1;35m has started.\u001b[0m\n", + "\u001b[1;35mStep \u001b[0m\u001b[33mskew_detector\u001b[1;35m has finished in 0.830s.\u001b[0m\n", + "\u001b[1;35mPipeline run \u001b[0m\u001b[33mdigits_pipeline_with_train_test_checks-2023_03_10-09_55_20_555028\u001b[1;35m has finished in 6.198s.\u001b[0m\n", + "\u001b[1;35mPipeline visualization can be seen in the ZenML Dashboard. Run \u001b[0m\u001b[33mzenml up\u001b[1;35m to see your pipeline!\u001b[0m\n" + ] + } + ], "source": [ "evidently_pipeline = digits_pipeline_with_train_test_checks(\n", " importer=importer(),\n", " trainer=svc_trainer(),\n", " evaluator=evaluator(),\n", " get_reference_data=get_reference_data(),\n", - " skew_detector=evidently_profile_step(\n", + " skew_detector=evidently_report_step(\n", " step_name=\"evidently_skew_detector\",\n", - " params=evidently_profile_params,\n", + " params=evidently_report_params,\n", " ),\n", ")\n", "evidently_pipeline.run(unlisted=True)" @@ -225,9 +247,67 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "
Loading...
\n", + "\n", + "\n", + "\n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "from zenml.integrations.evidently.visualizers import EvidentlyVisualizer\n", "from zenml.post_execution import get_unlisted_runs\n", @@ -252,7 +332,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3.8.13 64-bit ('zenbytes-dev')", + "display_name": "zenenv", "language": "python", "name": "python3" }, @@ -266,11 +346,11 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.13" + "version": "3.8.10" }, "vscode": { "interpreter": { - "hash": "ec45946565c50b1d690aa5a9e3c974f5b62b9cc8d8934e441e52186140f79402" + "hash": "8d0be979a033ea269fe1e2ffc63671e75ef3a9ac1410289007bbd9ed1b686109" } } },