From a05c2a03814c7ccdb70b1281bd186c263d1b5cba Mon Sep 17 00:00:00 2001 From: Erich Schubert Date: Wed, 2 Nov 2022 08:50:39 +0100 Subject: [PATCH] For kNN, include k=1 Quite often, k=1 works best, hence it should be included. --- baseline/PyOD.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/baseline/PyOD.py b/baseline/PyOD.py index adb651d..6ffd81a 100644 --- a/baseline/PyOD.py +++ b/baseline/PyOD.py @@ -66,7 +66,7 @@ def grid_hp(self, model_name): 'ECOD': None, 'FeatureBagging': [3, 5, 10, 20], # n_estimators, default=10 'HBOS': [3, 5, 10, 20], # n_bins, default=10 - 'KNN': [3, 5, 10, 20], # n_neighbors, default=5 + 'KNN': [1, 3, 5, 10, 20], # n_neighbors, default=5 'LMDD': ['aad', 'var', 'iqr'], # dis_measure, default='aad' 'LODA': [3, 5, 10, 20], # n_bins, default=10 'LOF': [5, 10, 20, 50], # n_neighbors, default=20 @@ -292,4 +292,4 @@ def fit(self, X_train, y_train, ratio=None): # from pyod: for consistency, outliers are assigned with larger anomaly scores def predict_score(self, X): score = self.model.decision_function(X) - return score \ No newline at end of file + return score