class_docstr: In this algorithm, anomalies are those data points that are above a percentage threshold as compared to the baseline.
  This algorithm assumes that time_series and baseline_time_series are perfectly aligned, meaning that:
   a) every timestamp that exists in time_series also exists in baseline_time_series
   b) lengths of both time series are same
class_docstr_tok: ["In","this","algorithm",",","anomalies","are","those","data","points","that","are","above","a","percentage","threshold","as","compared","to","the","baseline",".","This","algorithm","assumes","that","time_series","and","baseline_time_series","are","perfectly","aligned",",","meaning","that",":","a",")","every","timestamp","that","exists","in","time_series","also","exists","in","baseline_time_series","b",")","lengths","of","both","time","series","are","same"]
docstr: Compute anomaly scores for the time series
  This algorithm just takes the diff of threshold with current value as anomaly score
docstr_tok: ["Compute","anomaly","scores","for","the","time","series","This","algorithm","just","takes","the","diff","of","threshold","with","current","value","as","anomaly","score"]
code: def _set_scores(self):
      """
      Compute anomaly scores for the time series
      This algorithm just takes the diff of threshold with current value as anomaly score
      """
      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))
  
imports: from luminol import exceptions
  from luminol.algorithms.anomaly_detector_algorithms import AnomalyDetectorAlgorithm
  from luminol.modules.time_series import TimeSeries
label_desc: Use image node_id 2 for calling the DiffPercentThreshold obj's underlying member method code with example usage: obj._set_scores() without return types