code: def _calc_new_threshold(self, score):
          
          if self.threshold_mode == 'rel':
              abs_threshold_change = self.threshold * score
          else:
              abs_threshold_change = self.threshold
  
          if self.lower_is_better:
              new_threshold = score - abs_threshold_change
          else:
              new_threshold = score + abs_threshold_change
          return new_threshold
docs: Determine threshold based on score.