class_docstr: Method from Tran et al., 2018 performing poisoning detection based on Spectral Signatures
class_docstr_tok: ["Method","from","Tran","et","al.",",","2018","performing","poisoning","detection","based","on","Spectral","Signatures"]
docstr: If ground truth is known, this function returns a confusion matrix in the form of a JSON object.
  
  :param is_clean: Ground truth, where is_clean[i]=1 means that x_train[i] is clean and is_clean[i]=0 means
                   x_train[i] is poisonous.
  :param kwargs: A dictionary of defence-specific parameters.
  :return: JSON object with confusion matrix.
docstr_tok: ["If","ground","truth","is","known",",","this","function","returns","a","confusion","matrix","in","the","form","of","a","JSON","object",".",":","param","is_clean",":","Ground","truth",",","where","is_clean","[","i","]","=1","means","that","x_train","[","i","]","is","clean","and","is_clean","[","i","]","=0","means","x_train","[","i","]","is","poisonous",".",":","param","kwargs",":","A","dictionary","of","defence-specific","parameters",".",":","return",":","JSON","object","with","confusion","matrix","."]
code: def evaluate_defence(self, is_clean: np.ndarray, **kwargs) -> str:
      """
      If ground truth is known, this function returns a confusion matrix in the form of a JSON object.
  
      :param is_clean: Ground truth, where is_clean[i]=1 means that x_train[i] is clean and is_clean[i]=0 means
                       x_train[i] is poisonous.
      :param kwargs: A dictionary of defence-specific parameters.
      :return: JSON object with confusion matrix.
      """
      if is_clean is None or is_clean.size == 0:
          raise ValueError(
              "is_clean was not provided while invoking evaluate_defence."
          )
      is_clean_by_class = segment_by_class(
          is_clean, self.y_train, self.classifier.nb_classes
      )
      _, predicted_clean = self.detect_poison()
      predicted_clean_by_class = segment_by_class(
          predicted_clean, self.y_train, self.classifier.nb_classes
      )
  
      _, conf_matrix_json = self.evaluator.analyze_correctness(
          predicted_clean_by_class, is_clean_by_class
      )
  
      return conf_matrix_json
  
file_path: adversarial-robustness-toolbox/art/defences/detector/poison/spectral_signature_defense.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  from typing import List, Tuple, TYPE_CHECKING
  import numpy
  from art.defences.detector.poison.ground_truth_evaluator import GroundTruthEvaluator
  from art.defences.detector.poison.poison_filtering_defence import PoisonFilteringDefence
  from art.utils import segment_by_class
label_desc: Use image node_id 2 for calling the SpectralSignatureDefense obj's underlying member method code with example usage: obj.evaluate_defence(is_clean) and returns: conf_matrix_json