You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2019/06/04 00:04:03 UTC

[GitHub] [incubator-pinot] xiaohui-sun commented on a change in pull request #4266: [TE] Detection model maintenance flow

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

 ##########
 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:
   If it is only for the purpose of storing the null value can we use -1 instead?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

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