public Metric normalizePredictions(Metric predictions){
  Map<Long,String> metricData=predictions.getDatapoints();
  Map<String,Double> minMax=getMinMax(metricData);
  double min=minMax.get("min");
  double max=minMax.get("max");
  Metric predictionsNormalized=new Metric(getResultScopeName(),getResultMetricName());
  Map<Long,String> metricDataNormalized=new HashMap<>();
  if (max - min == 0.0) {
    for (    Long timestamp : metricData.keySet()) {
      metricDataNormalized.put(timestamp,"0.0");
    }
  }
 else {
    double normalizationConstant=100.0 / (max - min);
    for (    Entry<Long,String> entry : metricData.entrySet()) {
      Long timestamp=entry.getKey();
      Double value=Double.parseDouble(entry.getValue());
      Double valueNormalized=(value - min) * normalizationConstant;
      metricDataNormalized.put(timestamp,String.valueOf(valueNormalized));
    }
  }
  predictionsNormalized.setDatapoints(metricDataNormalized);
  return predictionsNormalized;
}

public Metric normalizePredictions ( Metric predictions ) { Map < Long , String > metricData = predictions . getDatapoints ( ) ; Map < String , Double > minMax = getMinMax ( metricData ) ; double min = minMax . get ( "min" ) ; double max = minMax . get ( "max" ) ; Metric predictionsNormalized = new Metric ( getResultScopeName ( ) , getResultMetricName ( ) ) ; Map < Long , String > metricDataNormalized = new HashMap < > ( ) ; if ( max - min == 0.0 ) { for ( Long timestamp : metricData . keySet ( ) ) { metricDataNormalized . put ( timestamp , "0.0" ) ; } } else { double normalizationConstant = 100.0 / ( max - min ) ; for ( Entry < Long , String > entry : metricData . entrySet ( ) ) { Long timestamp = entry . getKey ( ) ; Double value = Double . parseDouble ( entry . getValue ( ) ) ; Double valueNormalized = ( value - min ) * normalizationConstant ; metricDataNormalized . put ( timestamp , String . valueOf ( valueNormalized ) ) ; } } predictionsNormalized . setDatapoints ( metricDataNormalized ) ; return predictionsNormalized ; }
normalize predictions into a range of [ 0 , 100 ] . lowest value will map to 0 , highest value will map to 100 , rest will map to values in between . normalization formula : normalizedvalue = ( rawvalue - min ) * ( 100 / ( max - min ) )
