You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by xh...@apache.org on 2019/05/06 18:08:29 UTC

[incubator-pinot] branch master updated: [TE] Fix current value in HoltWinters baseline (#4186)

This is an automated email from the ASF dual-hosted git repository.

xhsun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new db84cbb  [TE] Fix current value in HoltWinters baseline (#4186)
db84cbb is described below

commit db84cbb87a0a7c8d1b7b3595e278844cf9648ab3
Author: Xiaohui Sun <xh...@linkedin.com>
AuthorDate: Mon May 6 11:08:23 2019 -0700

    [TE] Fix current value in HoltWinters baseline (#4186)
---
 .../pinot/thirdeye/detection/components/HoltWintersDetector.java | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/components/HoltWintersDetector.java b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/components/HoltWintersDetector.java
index 123f44c..8800f6d 100644
--- a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/components/HoltWintersDetector.java
+++ b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/components/HoltWintersDetector.java
@@ -140,6 +140,7 @@ public class HoltWintersDetector implements BaselineProvider<HoltWintersDetector
 
     DataFrame inputDf = fetchData(metricEntity, trainStart.getMillis(), window.getEndMillis());
     DataFrame resultDF = computePredictionInterval(inputDf, window.getStartMillis(), datasetConfig.getTimezone());
+    resultDF = resultDF.joinLeft(inputDf.renameSeries(COL_VALUE, COL_CURR), COL_TIME);
 
     // Exclude the end because baseline calculation should not contain the end
     if (resultDF.size() > 1) {
@@ -425,7 +426,6 @@ public class HoltWintersDetector implements BaselineProvider<HoltWintersDetector
 
     int size = forecastDF.size();
     double[] baselineArray = new double[size];
-    double[] currentArray = new double[size];
     double[] upperBoundArray = new double[size];
     double[] lowerBoundArray = new double[size];
     long[] resultTimeArray = new long[size];
@@ -466,12 +466,6 @@ public class HoltWintersDetector implements BaselineProvider<HoltWintersDetector
       double predicted = result.getPredictedValue();
       double error = result.getErrorBound();
 
-      // if current value doesn't have data then impute with NaN
-      if (k < y.length) {
-        currentArray[k] = y[k];
-      } else {
-        currentArray[k] = Double.NaN;
-      }
       baselineArray[k] = predicted;
       errorArray[k] = error;
       upperBoundArray[k] = predicted + error;
@@ -480,7 +474,6 @@ public class HoltWintersDetector implements BaselineProvider<HoltWintersDetector
 
     resultDF.addSeries(COL_TIME, LongSeries.buildFrom(resultTimeArray)).setIndex(COL_TIME);
     resultDF.addSeries(COL_VALUE, DoubleSeries.buildFrom(baselineArray));
-    resultDF.addSeries(COL_CURR, DoubleSeries.buildFrom(currentArray));
     resultDF.addSeries(COL_UPPER_BOUND, DoubleSeries.buildFrom(upperBoundArray));
     resultDF.addSeries(COL_LOWER_BOUND, DoubleSeries.buildFrom(lowerBoundArray));
     resultDF.addSeries(COL_ERROR, DoubleSeries.buildFrom(errorArray));


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org