class_docstr: Implementation of methods in Neural Cleanse: Identifying and Mitigating Backdoor Attacks in Neural Networks.
  Wang et al. (2019).
  
  | Paper link: https://people.cs.uchicago.edu/~ravenben/publications/pdf/backdoor-sp19.pdf
class_docstr_tok: ["Implementation","of","methods","in","Neural","Cleanse",":","Identifying","and","Mitigating","Backdoor","Attacks","in","Neural","Networks",".","Wang","et","al",".","(","2019",")",".","|","Paper","link",":","https",":","\/\/people.cs.uchicago.edu\/~ravenben\/publications\/pdf\/backdoor-sp19.pdf"]
docstr: Perform prediction of the given classifier for a batch of inputs, potentially filtering suspicious input
  
  :param x: Input samples.
  :param batch_size: Batch size.
  :return: Array of predictions of shape `(nb_inputs, nb_classes)`.
docstr_tok: ["Perform","prediction","of","the","given","classifier","for","a","batch","of","inputs",",","potentially","filtering","suspicious","input",":","param","x",":","Input","samples",".",":","param","batch_size",":","Batch","size",".",":","return",":","Array","of","predictions","of","shape","`","(","nb_inputs",",","nb_classes",")","`","."]
code: def predict(
      self,
      x: np.ndarray,
      batch_size: int = 128,
      training_mode: bool = False,
      **kwargs,
  ) -> np.ndarray:
      """
      Perform prediction of the given classifier for a batch of inputs, potentially filtering suspicious input
  
      :param x: Input samples.
      :param batch_size: Batch size.
      :return: Array of predictions of shape `(nb_inputs, nb_classes)`.
      """
      predictions = self._predict_classifier(
          x=x,
          batch_size=batch_size,
          training_mode=training_mode,
          **kwargs,
      )
  
      if len(self.top_indices) == 0:
          logger.warning(
              "Filtering mitigation not activated, suspected backdoors may be triggered"
          )
          return predictions
  
      all_activations = self._get_penultimate_layer_activations(x)
      suspected_neuron_activations = all_activations[
          :, self.top_indices
      ]
      predictions[
          np.any(
              suspected_neuron_activations > self.activation_threshold,
              axis=1,
          )
      ] = self.abstain()
  
      return predictions
  
file_path: adversarial-robustness-toolbox/art/estimators/poison_mitigation/neural_cleanse/neural_cleanse.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  from typing import Union, Tuple, List
  import numpy
  from art.estimators.certification.abstain import AbstainPredictorMixin
  from art.utils import to_categorical
label_desc: Use image node_id 6 for calling the NeuralCleanseMixin obj's underlying member method code with example usage: obj.predict(x, batch_size, training_mode) and returns: predictions, predictions