From 701a01d63d699e64d97eab0a56e1e3b9a5f33684 Mon Sep 17 00:00:00 2001 From: xeniape Date: Fri, 18 Oct 2024 12:43:28 +0200 Subject: [PATCH 1/2] ci: Remove unused dependency from demo image --- demos/signal-processing/requirements.txt | 1 - stacks/signal-processing/tsdb.ipynb | 19 +++++++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/demos/signal-processing/requirements.txt b/demos/signal-processing/requirements.txt index 74e8d0ed..e4661591 100644 --- a/demos/signal-processing/requirements.txt +++ b/demos/signal-processing/requirements.txt @@ -1,3 +1,2 @@ psycopg2-binary==2.9.9 -tsfresh==0.20.1 alibi-detect==0.11.4 \ No newline at end of file diff --git a/stacks/signal-processing/tsdb.ipynb b/stacks/signal-processing/tsdb.ipynb index 5e0f8fe8..17e87513 100644 --- a/stacks/signal-processing/tsdb.ipynb +++ b/stacks/signal-processing/tsdb.ipynb @@ -10,7 +10,6 @@ "# The following libraries have already been included in the jupyter image: see here demos/signal-processing/Dockerfile-jupyter\n", "# These are just left in as examples to show how other libraries can be added.\n", "#!pip install psycopg2-binary\n", - "#!pip install -U tsfresh\n", "#!pip install alibi-detect" ] }, @@ -103,18 +102,18 @@ "while True:\n", " clear_output(wait=True)\n", " display('Iteration: '+str(i))\n", - " \n", + "\n", " sql = f\"\"\"\\\n", " SELECT time, {', '.join(cols)}\n", - " from conditions \n", + " from conditions\n", " where (timestamp '{last_time}' = timestamp '1970-01-01' or time > timestamp '{last_time}') and time < now()\n", - " order by time asc \n", + " order by time asc\n", " limit 1000\n", " \"\"\"\n", - " \n", + "\n", " df = pd.read_sql_query(sql, engine)\n", " df_scores = df[['time']].copy()\n", - " \n", + "\n", " od = SpectralResidual(\n", " threshold=1.,\n", " window_amp=20,\n", @@ -125,7 +124,7 @@ " n_est_points=10,\n", " n_grad_points=5\n", " )\n", - " \n", + "\n", " for col in cols:\n", " result = od.predict(\n", " df[col].to_numpy(),\n", @@ -133,13 +132,13 @@ " return_instance_score=True\n", " )\n", " df_scores[col+'_score'] = result['data']['instance_score'].tolist()\n", - " \n", + "\n", " df_scores.to_sql('scores_sr', engine, index=False, if_exists='append')\n", - " \n", + "\n", " # get last timestamp to use for next offset\n", " last_time = pd.to_datetime(df.time.tail(1).values[0]).strftime('%Y-%m-%d %H:%M:%S.%f %Z')\n", " print(f'Next offset: {last_time}, fetched: {df_scores.r1_score.size}')\n", - " \n", + "\n", " time.sleep(12)\n", " i += 1" ] From d83e4a747027be096892e9c9662c7c7192fea137 Mon Sep 17 00:00:00 2001 From: xeniape Date: Fri, 18 Oct 2024 12:52:31 +0200 Subject: [PATCH 2/2] linter --- demos/signal-processing/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demos/signal-processing/requirements.txt b/demos/signal-processing/requirements.txt index e4661591..21dcca7c 100644 --- a/demos/signal-processing/requirements.txt +++ b/demos/signal-processing/requirements.txt @@ -1,2 +1,2 @@ psycopg2-binary==2.9.9 -alibi-detect==0.11.4 \ No newline at end of file +alibi-detect==0.11.4