diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-05-08 16:27:04 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-05-08 16:27:04 +0000 |
commit | a836a244a3d2bdd4da1ee2641e3e957850668cea (patch) | |
tree | cb87c75b3677fab7144f868435243f864048a1e6 /ml/KMeans.h | |
parent | Adding upstream version 1.38.1. (diff) | |
download | netdata-a836a244a3d2bdd4da1ee2641e3e957850668cea.tar.xz netdata-a836a244a3d2bdd4da1ee2641e3e957850668cea.zip |
Adding upstream version 1.39.0.upstream/1.39.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ml/KMeans.h')
-rw-r--r-- | ml/KMeans.h | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/ml/KMeans.h b/ml/KMeans.h deleted file mode 100644 index 0398eeb86..000000000 --- a/ml/KMeans.h +++ /dev/null @@ -1,41 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef KMEANS_H -#define KMEANS_H - -#include <atomic> -#include <vector> -#include <limits> -#include <mutex> - -#include "SamplesBuffer.h" -#include "json/single_include/nlohmann/json.hpp" - -class KMeans { -public: - KMeans(size_t NumClusters = 2) : NumClusters(NumClusters) { - MinDist = std::numeric_limits<CalculatedNumber>::max(); - MaxDist = std::numeric_limits<CalculatedNumber>::min(); - }; - - void train(const std::vector<DSample> &Samples, size_t MaxIterations); - CalculatedNumber anomalyScore(const DSample &Sample) const; - - void toJson(nlohmann::json &J) const { - J = nlohmann::json{ - {"CCs", ClusterCenters}, - {"MinDist", MinDist}, - {"MaxDist", MaxDist} - }; - } - -private: - size_t NumClusters; - - std::vector<DSample> ClusterCenters; - - CalculatedNumber MinDist; - CalculatedNumber MaxDist; -}; - -#endif /* KMEANS_H */ |