code: def _set_scores(self):
          
          anom_scores = {}
          for i, (timestamp, value) in enumerate(self.time_series.items()):
  
              baseline_value = self.baseline_time_series[i]
  
              if baseline_value > 0:
                  diff_percent = 100 * (value - baseline_value) / baseline_value
              elif value > 0:
                  diff_percent = 100.0
              else:
                  diff_percent = 0.0
  
              anom_scores[timestamp] = 0.0
              if self.percent_threshold_upper and diff_percent > 0 and diff_percent > self.percent_threshold_upper:
                  anom_scores[timestamp] = diff_percent
              if self.percent_threshold_lower and diff_percent < 0 and diff_percent < self.percent_threshold_lower:
                  anom_scores[timestamp] = -1 * diff_percent
  
          self.anom_scores = TimeSeries(self._denoise_scores(anom_scores))
docs: Compute anomaly scores for the time series
          This algorithm just takes the diff of threshold with current value as anomaly score