private Metric predictAnomalies(Map<Long,String> metricData){
  Metric predictions=new Metric(getResultScopeName(),getResultMetricName());
  Map<Long,String> predictionDatapoints=new HashMap<>();
  if (variance == 0.0) {
    for (    Entry<Long,String> entry : metricData.entrySet()) {
      Long timestamp=entry.getKey();
      predictionDatapoints.put(timestamp,"0.0");
    }
  }
 else {
    for (    Entry<Long,String> entry : metricData.entrySet()) {
      Long timestamp=entry.getKey();
      String valueString=entry.getValue();
      double valueDouble=Double.parseDouble(valueString);
      try {
        double anomalyScore=calculateAnomalyScore(valueDouble);
        predictionDatapoints.put(timestamp,String.valueOf(anomalyScore));
      }
 catch (      ArithmeticException e) {
        continue;
      }
    }
  }
  predictions.setDatapoints(predictionDatapoints);
  return predictions;
}

private Metric predictAnomalies ( Map < Long , String > metricData ) { Metric predictions = new Metric ( getResultScopeName ( ) , getResultMetricName ( ) ) ; Map < Long , String > predictionDatapoints = new HashMap < > ( ) ; if ( variance == 0.0 ) { for ( Entry < Long , String > entry : metricData . entrySet ( ) ) { Long timestamp = entry . getKey ( ) ; predictionDatapoints . put ( timestamp , "0.0" ) ; } } else { for ( Entry < Long , String > entry : metricData . entrySet ( ) ) { Long timestamp = entry . getKey ( ) ; String valueString = entry . getValue ( ) ; double valueDouble = Double . parseDouble ( valueString ) ; try { double anomalyScore = calculateAnomalyScore ( valueDouble ) ; predictionDatapoints . put ( timestamp , String . valueOf ( anomalyScore ) ) ; } catch ( ArithmeticException e ) { continue ; } } } predictions . setDatapoints ( predictionDatapoints ) ; return predictions ; }
assigns an anomaly score to each data point , indicating how likely it is to be an anomaly relative to other points .
