class_docstr: Implementation of a postprocessor based on adding the Reverse Sigmoid perturbation to classifier output.
docstr: Perform model postprocessing and return postprocessed output.
  
  :param preds: model output to be postprocessed.
  :return: Postprocessed model output.
docstr_tok: ["Perform","model","postprocessing","and","return","postprocessed","output",".",":","param","preds",":","model","output","to","be","postprocessed",".",":","return",":","Postprocessed","model","output","."]
code: def __call__(self, preds: np.ndarray) -> np.ndarray:
      """
      Perform model postprocessing and return postprocessed output.
  
      :param preds: model output to be postprocessed.
      :return: Postprocessed model output.
      """
      clip_min = 1e-9
      clip_max = 1.0 - clip_min
  
      def sigmoid(var_z):
          return 1.0 / (1.0 + np.exp(-var_z))
  
      preds_clipped = np.clip(preds, clip_min, clip_max)
  
      if preds.shape[1] > 1:
          perturbation_r = self.beta * (
              sigmoid(
                  -self.gamma
                  * np.log((1.0 - preds_clipped) / preds_clipped)
              )
              - 0.5
          )
          preds_perturbed = preds - perturbation_r
          preds_perturbed = np.clip(preds_perturbed, 0.0, 1.0)
          alpha = 1.0 / np.sum(preds_perturbed, axis=-1, keepdims=True)
          reverse_sigmoid = alpha * preds_perturbed
      else:
          preds_1 = preds
          preds_2 = 1.0 - preds
  
          preds_clipped_1 = preds_clipped
          preds_clipped_2 = 1.0 - preds_clipped
  
          perturbation_r_1 = self.beta * (
              sigmoid(
                  -self.gamma
                  * np.log((1.0 - preds_clipped_1) / preds_clipped_1)
              )
              - 0.5
          )
          perturbation_r_2 = self.beta * (
              sigmoid(
                  -self.gamma
                  * np.log((1.0 - preds_clipped_2) / preds_clipped_2)
              )
              - 0.5
          )
  
          preds_perturbed_1 = preds_1 - perturbation_r_1
          preds_perturbed_2 = preds_2 - perturbation_r_2
  
          preds_perturbed_1 = np.clip(preds_perturbed_1, 0.0, 1.0)
          preds_perturbed_2 = np.clip(preds_perturbed_2, 0.0, 1.0)
  
          alpha = 1.0 / (preds_perturbed_1 + preds_perturbed_2)
          reverse_sigmoid = alpha * preds_perturbed_1
  
      return reverse_sigmoid
  
file_path: adversarial-robustness-toolbox/art/defences/postprocessor/reverse_sigmoid.py
imports: import logging
  import numpy
  from art.defences.postprocessor.postprocessor import Postprocessor
label_desc: Use image node_id 2 for calling the ReverseSigmoid obj's underlying member method code with example usage: obj.__call__(preds) and returns: reverse_sigmoid, unknown