fixbug: wrong label in dbscan.

This commit is contained in:
huangbin 2024-11-22 09:45:40 +08:00
parent 0bffe1d038
commit e6ee71b417
2 changed files with 30 additions and 1 deletions

View File

@ -0,0 +1,25 @@
From e5850e2df3918b17d029f796e71825bec0dcf0ed Mon Sep 17 00:00:00 2001
From: huangbin <huangbin58@huawei.com>
Date: Thu, 21 Nov 2024 18:29:56 +0800
Subject: [PATCH] fixbug wrong label for dbscan
---
.../slow_node_algs/space_comp_detector/sliding_window_dbscan.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/anteater/model/algorithms/slow_node_algs/space_comp_detector/sliding_window_dbscan.py b/anteater/model/algorithms/slow_node_algs/space_comp_detector/sliding_window_dbscan.py
index cccae33..0bace48 100644
--- a/anteater/model/algorithms/slow_node_algs/space_comp_detector/sliding_window_dbscan.py
+++ b/anteater/model/algorithms/slow_node_algs/space_comp_detector/sliding_window_dbscan.py
@@ -109,6 +109,8 @@ class SlidingWindowDBSCAN():
labels = dbscan.fit_predict(sim_scores)
logger.info(f"dnscan labels: {labels}")
label_counts = Counter(labels)
+ if -1 in label_counts:
+ label_counts.pop(-1)
# 找到样本数量最多的类别
most_common_label, _ = label_counts.most_common(1)[0]
new_labels = np.where(labels == most_common_label, 0, 1)
--
2.43.0

View File

@ -2,7 +2,7 @@
Name: gala-anteater
Version: 1.2.1
Release: 4
Release: 5
Summary: A time-series anomaly detection platform for operating system.
License: MulanPSL2
URL: https://gitee.com/openeuler/gala-anteater
@ -14,6 +14,7 @@ Requires: python3-gala-anteater = %{version}-%{release}
patch0: 0001-add-new-feature-slow-node-detection.patch
patch1: 0002-configure-group-in-json.patch
patch2: 0003-remove-unuse-code.patch
patch3: 0004-fixbug-wrong-label-for-dbscan.patch
%description
Abnormal detection module for A-Ops project
@ -81,6 +82,9 @@ fi
%changelog
* Thu Nov 21 2024 huangbin <huangbin58@huawei.com> - 1.2.1-5
- fixbug with wrong label in dbscan.
* Mon Nov 11 2024 huangbin <huangbin58@huawei.com> - 1.2.1-4
- solve conflict.