diff options
Diffstat (limited to 'ml/kmeans/SamplesBuffer.cc')
-rw-r--r-- | ml/kmeans/SamplesBuffer.cc | 6 |
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)); |