summaryrefslogtreecommitdiffstats
path: root/ml/kmeans/SamplesBuffer.cc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-04-14 18:12:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-04-14 18:12:10 +0000
commitb5321aff06d6ea8d730d62aec2ffd8e9271c1ffc (patch)
tree36c41e35994786456154f9d3bf88c324763aeea4 /ml/kmeans/SamplesBuffer.cc
parentAdding upstream version 1.33.1. (diff)
downloadnetdata-b5321aff06d6ea8d730d62aec2ffd8e9271c1ffc.tar.xz
netdata-b5321aff06d6ea8d730d62aec2ffd8e9271c1ffc.zip
Adding upstream version 1.34.0.upstream/1.34.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ml/kmeans/SamplesBuffer.cc')
-rw-r--r--ml/kmeans/SamplesBuffer.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/ml/kmeans/SamplesBuffer.cc b/ml/kmeans/SamplesBuffer.cc
index f8211fb5..d276c6e0 100644
--- a/ml/kmeans/SamplesBuffer.cc
+++ b/ml/kmeans/SamplesBuffer.cc
@@ -130,7 +130,13 @@ std::vector<DSample> SamplesBuffer::preprocess() {
DSamples.reserve(OutN);
Preprocessed = true;
+ uint32_t MaxMT = std::numeric_limits<uint32_t>::max();
+ uint32_t CutOff = static_cast<double>(MaxMT) * SamplingRatio;
+
for (size_t Idx = NumSamples - OutN; Idx != NumSamples; Idx++) {
+ if (RandNums[Idx] > CutOff)
+ continue;
+
DSample DS;
DS.set_size(NumDimsPerSample * (LagN + 1));