class_docstr: Copy of DiffPercentThreshold Algorithm from algorithms/anomaly_detector_algorithms/diff_percent_threshold.py to test
  whether passing a AnomalyDetectorAlgorithm class works for AnomalyDetector module
class_docstr_tok: ["Copy","of","DiffPercentThreshold","Algorithm","from","algorithms\/anomaly_detector_algorithms\/diff_percent_threshold.py","to","test","whether","passing","a","AnomalyDetectorAlgorithm","class","works","for","AnomalyDetector","module"]
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: import os
  import sys
  import unittest
  from luminol import exceptions
  from luminol.anomaly_detector import AnomalyDetector
  from luminol.modules.time_series import TimeSeries
  from luminol.algorithms.anomaly_detector_algorithms import AnomalyDetectorAlgorithm
label_desc: Use image node_id 2 for calling the CustomAlgo obj's underlying member method code with example usage: obj._set_scores() without return types