From a5fd7d20ff5f049a55abb04c7854c6b7bee5f0d8 Mon Sep 17 00:00:00 2001 From: HiIAmTzeKean Date: Fri, 29 Nov 2024 17:17:54 +0800 Subject: [PATCH] fix: output logs control --- examples/demo_pipeline.ipynb | 212 +++++++++-------------------------- 1 file changed, 54 insertions(+), 158 deletions(-) diff --git a/examples/demo_pipeline.ipynb b/examples/demo_pipeline.ipynb index 8b6d3d8..61c0dc7 100644 --- a/examples/demo_pipeline.ipynb +++ b/examples/demo_pipeline.ipynb @@ -13,7 +13,7 @@ "We will use Amazon movie data to show case the pipeline and some of the common\n", "methods that you can call to evaluate your RecSys algorithms.\n", "\n", - "To start off, we will set the k+100 value to be 10 first. This will mean that\n", + "To start off, we will set the `k` value to be 10 first. This will mean that\n", "for any of the top K metric or algorithm, we will only consider the top 10\n", "recommendations." ] @@ -27,6 +27,25 @@ "k = 10" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "If you want to ignore all warning that streamsight may raise, you can set the\n", + "following warning filter to ignore all warnings." + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "import streamsight\n", + "streamsight.log_level_by_name(\"INFO\")\n", + "streamsight.suppress_warnings(True)" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -43,29 +62,31 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "\u001b[32mINFO \u001b[0m - streamsight.datasets.base - \u001b[34mAmazonMovieDataset is loading dataset...\u001b[0m\n", - "\u001b[32mINFO \u001b[0m - streamsight.datasets.base - \u001b[34mAmazonMovieDataset dataset loaded - Took 12.9s\u001b[0m\n" + "INFO - AmazonMovieDataset is loading dataset...\n", + "INFO - AmazonMovieDataset dataset loaded - Took 11.9s\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ - "4it [00:01, 3.96it/s] " + "4it [00:00, 4.37it/s] " ] }, { "name": "stdout", "output_type": "stream", "text": [ - "\u001b[32mINFO \u001b[0m - streamsight.settings.sliding_window_setting - \u001b[34mFinished split with window size 2592000 seconds. Number of splits: 4 in total.\u001b[0m\n" + "INFO - Finished split with window size 2592000 seconds. Number of splits: 4 in total.\n", + "INFO - SlidingWindowSetting data split - Took 1.1s\n", + "INFO - SlidingWindowSetting data split complete.\n" ] }, { @@ -112,14 +133,14 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "\u001b[32mINFO \u001b[0m - streamsight.evaluators.evaluator_pipeline - \u001b[34mPhase 1: Preparing the evaluator...\u001b[0m\n" + "INFO - Phase 1: Preparing the evaluator...\n" ] }, { @@ -133,60 +154,60 @@ "name": "stdout", "output_type": "stream", "text": [ - "\u001b[32mINFO \u001b[0m - streamsight.evaluators.evaluator_pipeline - \u001b[34mPhase 2: Evaluating the algorithms...\u001b[0m\n", - "\u001b[32mINFO \u001b[0m - streamsight.evaluators.evaluator_pipeline - \u001b[34mPhase 3: Releasing the data...\u001b[0m\n" + "INFO - Phase 2: Evaluating the algorithms...\n", + "INFO - Phase 3: Releasing the data...\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ - " 25%|██▌ | 1/4 [00:47<02:23, 47.99s/it]" + " 25%|██▌ | 1/4 [00:48<02:24, 48.07s/it]" ] }, { "name": "stdout", "output_type": "stream", "text": [ - "\u001b[32mINFO \u001b[0m - streamsight.evaluators.evaluator_pipeline - \u001b[34mPhase 2: Evaluating the algorithms...\u001b[0m\n", - "\u001b[32mINFO \u001b[0m - streamsight.evaluators.evaluator_pipeline - \u001b[34mPhase 3: Releasing the data...\u001b[0m\n" + "INFO - Phase 2: Evaluating the algorithms...\n", + "INFO - Phase 3: Releasing the data...\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ - " 50%|█████ | 2/4 [01:21<01:19, 39.52s/it]" + " 50%|█████ | 2/4 [01:22<01:19, 39.77s/it]" ] }, { "name": "stdout", "output_type": "stream", "text": [ - "\u001b[32mINFO \u001b[0m - streamsight.evaluators.evaluator_pipeline - \u001b[34mPhase 2: Evaluating the algorithms...\u001b[0m\n", - "\u001b[32mINFO \u001b[0m - streamsight.evaluators.evaluator_pipeline - \u001b[34mPhase 3: Releasing the data...\u001b[0m\n" + "INFO - Phase 2: Evaluating the algorithms...\n", + "INFO - Phase 3: Releasing the data...\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ - " 75%|███████▌ | 3/4 [01:42<00:30, 30.91s/it]" + " 75%|███████▌ | 3/4 [01:42<00:30, 30.87s/it]" ] }, { "name": "stdout", "output_type": "stream", "text": [ - "\u001b[32mINFO \u001b[0m - streamsight.evaluators.evaluator_pipeline - \u001b[34mPhase 2: Evaluating the algorithms...\u001b[0m\n", - "\u001b[32mINFO \u001b[0m - streamsight.evaluators.evaluator_pipeline - \u001b[34mPhase 3: Releasing the data...\u001b[0m\n" + "INFO - Phase 2: Evaluating the algorithms...\n", + "INFO - Phase 3: Releasing the data...\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ - "100%|██████████| 4/4 [01:56<00:00, 29.09s/it]\n" + "100%|██████████| 4/4 [01:56<00:00, 29.03s/it]\n" ] } ], @@ -226,21 +247,9 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 5, "metadata": {}, "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\u001b[33mWARNING \u001b[0m - py.warnings - \u001b[34m/Users/ngtzekean/Github/Streamsight/streamsight/metrics/base.py:394: UserWarning: All predictions were off or the ground truth matrix was empty during compute of PrecisionK(timestamp_limit=1537776000,K=10).\n", - " warn(UserWarning(f\"All predictions were off or the ground truth matrix was empty during compute of {self.identifier}.\"))\n", - "\u001b[0m\n", - "\u001b[33mWARNING \u001b[0m - py.warnings - \u001b[34m/Users/ngtzekean/Github/Streamsight/streamsight/metrics/base.py:394: UserWarning: All predictions were off or the ground truth matrix was empty during compute of RecallK(timestamp_limit=1537776000,K=10).\n", - " warn(UserWarning(f\"All predictions were off or the ground truth matrix was empty during compute of {self.identifier}.\"))\n", - "\u001b[0m\n" - ] - }, { "data": { "text/html": [ @@ -335,7 +344,7 @@ " RecallK_10 0.063441 4" ] }, - "execution_count": 4, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } @@ -346,18 +355,9 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 6, "metadata": {}, "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\u001b[33mWARNING \u001b[0m - py.warnings - \u001b[34m/Users/ngtzekean/Github/Streamsight/.venv/lib/python3.12/site-packages/numpy/core/_methods.py:49: RuntimeWarning: overflow encountered in scalar add\n", - " return umr_sum(a, axis, dtype, out, keepdims, initial, where)\n", - "\u001b[0m\n" - ] - }, { "data": { "text/html": [ @@ -452,7 +452,7 @@ " RecallK_10 0.043027 7749" ] }, - "execution_count": 5, + "execution_count": 6, "metadata": {}, "output_type": "execute_result" } @@ -463,21 +463,9 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 7, "metadata": {}, "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\u001b[33mWARNING \u001b[0m - py.warnings - \u001b[34m/Users/ngtzekean/Github/Streamsight/streamsight/metrics/base.py:394: UserWarning: All predictions were off or the ground truth matrix was empty during compute of PrecisionK(timestamp_limit=1537776000,K=10).\n", - " warn(UserWarning(f\"All predictions were off or the ground truth matrix was empty during compute of {self.identifier}.\"))\n", - "\u001b[0m\n", - "\u001b[33mWARNING \u001b[0m - py.warnings - \u001b[34m/Users/ngtzekean/Github/Streamsight/streamsight/metrics/base.py:394: UserWarning: All predictions were off or the ground truth matrix was empty during compute of RecallK(timestamp_limit=1537776000,K=10).\n", - " warn(UserWarning(f\"All predictions were off or the ground truth matrix was empty during compute of {self.identifier}.\"))\n", - "\u001b[0m\n" - ] - }, { "data": { "text/html": [ @@ -734,7 +722,7 @@ " RecallK_10 0.068182 44" ] }, - "execution_count": 6, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" } @@ -760,98 +748,15 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 8, "metadata": {}, "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\u001b[32mINFO \u001b[0m - streamsight.datasets.base - \u001b[34mAmazonMovieDataset is loading dataset...\u001b[0m\n", - "\u001b[32mINFO \u001b[0m - streamsight.datasets.base - \u001b[34mAmazonMovieDataset dataset loaded - Took 12.5s\u001b[0m\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "4it [00:01, 3.80it/s] " - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\u001b[32mINFO \u001b[0m - streamsight.settings.sliding_window_setting - \u001b[34mFinished split with window size 2592000 seconds. Number of splits: 4 in total.\u001b[0m\n", - "\u001b[32mINFO \u001b[0m - streamsight.evaluators.evaluator_pipeline - \u001b[34mPhase 1: Preparing the evaluator...\u001b[0m\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "\n", - " 0%| | 0/4 [00:00