summaryrefslogtreecommitdiffstats
path: root/ml
diff options
context:
space:
mode:
authorvkalintiris <vasilis@netdata.cloud>2022-05-31 13:31:35 +0300
committerGitHub <noreply@github.com>2022-05-31 13:31:35 +0300
commitd36896ed06478dda312567a8f987e3802fe14c22 (patch)
tree1cac2056143cd53dedfa42004bc7b4fd16118c14 /ml
parent665f7ba25b4934bb040bdf4bd6d53a3d80b72457 (diff)
Treat dimensions as normal when we don't have enough/valid data. (#13005)
Ideally, we'd log such cases but this is not currently feasible because we have to process thousands of dimensions per second.
Diffstat (limited to 'ml')
-rw-r--r--ml/Dimension.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/ml/Dimension.cc b/ml/Dimension.cc
index 290d4c7439..3146e45a6c 100644
--- a/ml/Dimension.cc
+++ b/ml/Dimension.cc
@@ -161,8 +161,10 @@ void PredictableDimension::addValue(CalculatedNumber Value, bool Exists) {
std::pair<MLResult, bool> PredictableDimension::predict() {
unsigned N = Cfg.DiffN + Cfg.SmoothN + Cfg.LagN;
- if (CNs.size() != N)
+ if (CNs.size() != N) {
+ AnomalyBit = false;
return { MLResult::MissingData, AnomalyBit };
+ }
CalculatedNumber *TmpCNs = new CalculatedNumber[N * (Cfg.LagN + 1)]();
std::memcpy(TmpCNs, CNs.data(), N * sizeof(CalculatedNumber));
@@ -172,8 +174,10 @@ std::pair<MLResult, bool> PredictableDimension::predict() {
AnomalyScore = computeAnomalyScore(SB);
delete[] TmpCNs;
- if (AnomalyScore == std::numeric_limits<CalculatedNumber>::quiet_NaN())
+ if (AnomalyScore == std::numeric_limits<CalculatedNumber>::quiet_NaN()) {
+ AnomalyBit = false;
return { MLResult::NaN, AnomalyBit };
+ }
AnomalyBit = AnomalyScore >= (100 * Cfg.DimensionAnomalyScoreThreshold);
return { MLResult::Success, AnomalyBit };