Skip to content

Commit

Permalink
include accumulated anomaly score column in output
Browse files Browse the repository at this point in the history
  • Loading branch information
Yibei990826 committed Nov 28, 2024
1 parent e3fa7ce commit 350ef80
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions nbs/src/nixtla_client.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1811,6 +1811,8 @@
" .reset_index(drop=True))\n",
" out = ufp.assign_columns(out, 'anomaly', resp['anomaly'])\n",
" out = ufp.assign_columns(out, 'anomaly_score', resp['anomaly_score'])\n",
" if resp['accumulated_anomaly_score']is not None:\n",
" out = ufp.assign_columns(out, 'accumulated_anomaly_score', resp['accumulated_anomaly_score'])\n",
" return _maybe_add_intervals(out, resp['intervals'])\n",
"\n",
" def _distributed_cross_validation(\n",
Expand Down
4 changes: 4 additions & 0 deletions nixtla/nixtla_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1752,6 +1752,10 @@ def detect_anomalies_realtime(
out = out_aggregated.groupby(id_col).tail(detection_size).reset_index(drop=True)
out = ufp.assign_columns(out, "anomaly", resp["anomaly"])
out = ufp.assign_columns(out, "anomaly_score", resp["anomaly_score"])
if resp["accumulated_anomaly_score"] is not None:
out = ufp.assign_columns(
out, "accumulated_anomaly_score", resp["accumulated_anomaly_score"]
)
return _maybe_add_intervals(out, resp["intervals"])

def _distributed_cross_validation(
Expand Down

0 comments on commit 350ef80

Please sign in to comment.