diff --git a/popmon/notebooks/popmon_tutorial_advanced.ipynb b/popmon/notebooks/popmon_tutorial_advanced.ipynb index 7272761b..f7622d48 100644 --- a/popmon/notebooks/popmon_tutorial_advanced.ipynb +++ b/popmon/notebooks/popmon_tutorial_advanced.ipynb @@ -11,7 +11,6 @@ "cell_type": "code", "execution_count": null, "metadata": { - "collapsed": false, "jupyter": { "outputs_hidden": false }, @@ -47,7 +46,8 @@ "import pandas as pd\n", "\n", "import popmon\n", - "from popmon import resources" + "from popmon import resources\n", + "from popmon.config import Settings, Report" ] }, { @@ -103,8 +103,11 @@ "metadata": {}, "outputs": [], "source": [ + "settings = Settings()\n", + "settings.report.extended_report = False\n", + "\n", "df.pm_stability_report(\n", - " time_axis=\"DATE\", time_width=\"1w\", time_offset=\"2015-07-02\", extended_report=False\n", + " time_axis=\"DATE\", time_width=\"1w\", time_offset=\"2015-07-02\", settings=settings\n", ")" ] }, @@ -122,12 +125,14 @@ "metadata": {}, "outputs": [], "source": [ + "# reuse the previous settings\n", + "settings.monitoring.pull_rules={\"*_pull\": [10, 7, -7, -10]}\n", + "\n", "df.pm_stability_report(\n", " time_axis=\"DATE\",\n", " time_width=\"1w\",\n", " time_offset=\"2015-07-02\",\n", - " extended_report=False,\n", - " pull_rules={\"*_pull\": [10, 7, -7, -10]},\n", + " settings=settings,\n", ")" ] }, @@ -178,11 +183,14 @@ "\n", " sdf = spark.createDataFrame(df)\n", "\n", + " settings = Settings()\n", + " settings.report.extended_report = False\n", + "\n", " sdf.pm_stability_report(\n", " time_axis=\"DATE\",\n", " time_width=\"1w\",\n", " time_offset=\"2015-07-02\",\n", - " extended_report=False,\n", + " settings=settings,\n", " )" ] }, @@ -204,6 +212,9 @@ "metadata": {}, "outputs": [], "source": [ + "settings = Settings()\n", + "settings.report.extended_report = False\n", + "\n", "df_ref = pd.read_csv(\n", " resources.data(\"flight_delays_reference.csv.gz\"), index_col=0, parse_dates=[\"DATE\"]\n", ")\n", @@ -211,9 +222,9 @@ " time_axis=\"DATE\",\n", " time_width=\"1w\",\n", " time_offset=\"2015-07-02\",\n", - " extended_report=False,\n", " reference_type=\"external\",\n", " reference=df_ref,\n", + " settings=settings,\n", ")" ] }, @@ -235,8 +246,8 @@ " time_axis=\"DATE\",\n", " time_width=\"1w\",\n", " time_offset=\"2015-07-02\",\n", - " extended_report=False,\n", " reference_type=\"expanding\",\n", + " settings=settings,\n", ")" ] }, @@ -255,13 +266,14 @@ "metadata": {}, "outputs": [], "source": [ + "settings.comparison.window = 5\n", + "\n", "df.pm_stability_report(\n", " time_axis=\"DATE\",\n", " time_width=\"1w\",\n", " time_offset=\"2015-07-02\",\n", - " extended_report=False,\n", " reference_type=\"rolling\",\n", - " window=5,\n", + " settings=settings,\n", ")" ] }, @@ -400,15 +412,18 @@ "metadata": {}, "outputs": [], "source": [ + "report_settings = Report()\n", + "report_settings.last_n = 0\n", + "report_settings.skip_first_n = 0\n", + "report_settings.skip_last_n = 0\n", + "report_settings.section.histograms.plot_hist_n = 2\n", + "report_settings.skip_empty_plots = True\n", + "report_settings.report_filepath = None\n", + "\n", "report.regenerate(\n", - " last_n=0,\n", - " skip_first_n=0,\n", - " skip_last_n=0,\n", - " plot_hist_n=2,\n", - " skip_empty_plots=True,\n", - " report_filepath=None,\n", " store_key=\"html_report\",\n", " sections_key=\"report_sections\",\n", + " report_settings=settings,\n", ")" ] }, @@ -432,11 +447,7 @@ "from popmon.base import Pipeline\n", "from popmon.visualization import SectionGenerator, ReportGenerator\n", "\n", - "monitoring_rules = {\n", - " \"*_pull\": [7, 4, -4, -7],\n", - " \"*_zscore\": [7, 4, -4, -7],\n", - " \"[!p]*_unknown_labels\": [0.5, 0.5, 0, 0],\n", - "}\n", + "\n", "datastore = {\n", " \"hists\": df.pm_make_histograms(time_axis=\"DATE\", time_width=\"1w\", time_offset=\"2015-07-02\")\n", "}\n", @@ -556,7 +567,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.7" + "version": "3.8.8" }, "nteract": { "version": "0.15.0" diff --git a/popmon/notebooks/popmon_tutorial_basic.ipynb b/popmon/notebooks/popmon_tutorial_basic.ipynb index 3c086ea0..fadcf170 100644 --- a/popmon/notebooks/popmon_tutorial_basic.ipynb +++ b/popmon/notebooks/popmon_tutorial_basic.ipynb @@ -18,7 +18,6 @@ "cell_type": "code", "execution_count": null, "metadata": { - "collapsed": false, "jupyter": { "outputs_hidden": false }, @@ -76,7 +75,8 @@ "source": [ "import pandas as pd\n", "import popmon\n", - "from popmon import resources" + "from popmon import resources\n", + "from popmon.config import Report" ] }, { @@ -149,7 +149,11 @@ }, "outputs": [], "source": [ - "report.regenerate(extended_report=False, plot_hist_n=3)" + "report_settings = Report()\n", + "report_settings.extended_report = False\n", + "report_settings.section.histograms.plot_hist_n = 6\n", + "\n", + "report.regenerate(report_settings=report_settings)" ] }, {