jihaozh commented on a change in pull request #4266: [TE] Detection model 
maintenance flow
URL: https://github.com/apache/incubator-pinot/pull/4266#discussion_r290506677
 
 

 ##########
 File path: 
thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/datalayer/dto/EvaluationDTO.java
 ##########
 @@ -46,10 +46,15 @@ public static EvaluationDTO 
fromPredictionResult(PredictionResult predictionResu
     return evaluation;
   }
 
-  private static double getMape(PredictionResult result) {
+  private static Double getMape(PredictionResult result) {
     DataFrame df = result.getPredictedTimeSeries();
     // drop zero current value for mape calculation
     df = df.filter(df.getDoubles(COL_CURRENT).ne(0.0)).dropNull(COL_CURRENT, 
COL_VALUE);
-    return Evaluation.calculateMape(df.getDoubles(COL_CURRENT), 
df.getDoubles(COL_VALUE));
+    Double mape = Evaluation.calculateMape(df.getDoubles(COL_CURRENT), 
df.getDoubles(COL_VALUE));
+    if (Double.isNaN(mape)) {
+      // explicitly swap NaN to null values because mysql doesn't support 
storing NaN and will thrown a exception.
+      mape = null;
 
 Review comment:
   We could. But using -1 might affect the result of calculating average MAPE. 
If using null, we can filter the nulls by calling dropNull().

----------------------------------------------------------------
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