akshayrai commented on a change in pull request #4960: [TE] Use upper and lower 
bounds as predicted for threshold algorithm
URL: https://github.com/apache/incubator-pinot/pull/4960#discussion_r363620810
 
 

 ##########
 File path: 
thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/components/ThresholdRuleDetector.java
 ##########
 @@ -101,15 +100,24 @@ public TimeSeries computePredictedTimeSeries(MetricSlice 
slice) {
     InputData data =
         this.dataFetcher.fetchData(new 
InputDataSpec().withTimeseriesSlices(Collections.singletonList(slice)));
     DataFrame df = data.getTimeseries().get(slice);
-    return TimeSeries.fromDataFrame(constructThresholdBoundaries(df));
+    return TimeSeries.fromDataFrame(constructBaselineAndBoundaries(df));
   }
 
-  private DataFrame constructThresholdBoundaries(DataFrame df) {
+  /**
+   * Populate the dataframe with upper/lower boundaries and baseline
+   */
+  private DataFrame constructBaselineAndBoundaries(DataFrame df) {
+    // Set default baseline as the actual value
+    df.addSeries(COL_VALUE, df.getDoubles(COL_CURRENT));
     if (!Double.isNaN(this.min)) {
       df.addSeries(COL_LOWER_BOUND, DoubleSeries.fillValues(df.size(), 
this.min));
+      // set baseline value as the lower bound when actual value across below 
the mark
+      df.mapInPlace(DoubleSeries.MAX, COL_VALUE, COL_LOWER_BOUND, COL_VALUE);
 
 Review comment:
   ```Why we want to change the baseline value?```
   I updated the description. Pls take a look there. This is addressing user 
ticket APA-11365. This PR is not proposing any changes to upper/lower bounds. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to