code: private Metric predictAnomalies(Map<Long, Double> metricData) {
          Metric predictions = new Metric(getResultScopeName(), getResultMetricName());
          Map<Long, Double> predictionDatapoints = new HashMap<>();
  
          if (variance == 0.0) {
              /**
               * If variance is 0, there are no anomalies.
               * Also, using 0 for variance would cause divide by zero operations
               * in Gaussian anomaly formulas. This condition avoids such operations.
               */
              for (Entry<Long, Double> entry : metricData.entrySet()) {
                  Long timestamp = entry.getKey();
                  predictionDatapoints.put(timestamp, 0.0);
              }
          } else {
              for (Entry<Long, Double> entry : metricData.entrySet()) {
                  Long timestamp = entry.getKey();
                  double value = entry.getValue();
                  try {
                      double anomalyScore = calculateAnomalyScore(value);
                      predictionDatapoints.put(timestamp, anomalyScore);
                  } catch (ArithmeticException e) {
                      continue;
                  }
              }
          }
  
          predictions.setDatapoints(predictionDatapoints);
          return predictions;
      }
docs: Assigns an anomaly score to each data point, indicating how likely it is
  to be an anomaly relative to other points.