class_docstr: Close implementation based on description in Nelson
  'Behavior of Machine Learning Algorithms in Adversarial Environments' Ch. 4.4
  
  | Textbook link: https://people.eecs.berkeley.edu/~adj/publications/paper-files/EECS-2010-140.pdf
class_docstr_tok: ["Close","implementation","based","on","description","in","Nelson","'Behavior","of","Machine","Learning","Algorithms","in","Adversarial","Environments","'","Ch",".","4.4","|","Textbook","link",":","https",":","\/\/people.eecs.berkeley.edu\/~adj\/publications\/paper-files\/EECS-2010-140.pdf"]
docstr: Returns poison detected and a report.
  
  :param kwargs: A dictionary of detection-specific parameters.
  :return: (report, is_clean_lst):
          where a report is a dict object that contains information specified by the provenance detection method
          where is_clean is a list, where is_clean_lst[i]=1 means that x_train[i]
          there is clean and is_clean_lst[i]=0, means that x_train[i] was classified as poison.
docstr_tok: ["Returns","poison","detected","and","a","report",".",":","param","kwargs",":","A","dictionary","of","detection-specific","parameters",".",":","return",":","(","report",",","is_clean_lst",")",":","where","a","report","is","a","dict","object","that","contains","information","specified","by","the","provenance","detection","method","where","is_clean","is","a","list",",","where","is_clean_lst","[","i","]","=1","means","that","x_train","[","i","]","there","is","clean","and","is_clean_lst","[","i","]","=0",",","means","that","x_train","[","i","]","was","classified","as","poison","."]
code: def detect_poison(self, **kwargs) -> Tuple[dict, List[int]]:
      """
      Returns poison detected and a report.
  
      :param kwargs: A dictionary of detection-specific parameters.
      :return: (report, is_clean_lst):
              where a report is a dict object that contains information specified by the provenance detection method
              where is_clean is a list, where is_clean_lst[i]=1 means that x_train[i]
              there is clean and is_clean_lst[i]=0, means that x_train[i] was classified as poison.
      """
      self.set_params(**kwargs)
  
      x_suspect = self.x_train
      y_suspect = self.y_train
      x_trusted = self.x_val
      y_trusted = self.y_val
  
      self.is_clean_lst = [1 for _ in range(len(x_suspect))]
      report = {}
  
      before_classifier = deepcopy(self.classifier)
      before_classifier.fit(x_suspect, y_suspect)
  
      for idx in np.random.permutation(len(x_suspect)):
          x_i = x_suspect[idx]
          y_i = y_suspect[idx]
  
          after_classifier = deepcopy(before_classifier)
          after_classifier.fit(
              x=np.vstack([x_trusted, x_i]),
              y=np.vstack([y_trusted, y_i]),
          )
          acc_shift = performance_diff(
              before_classifier,
              after_classifier,
              self.x_quiz,
              self.y_quiz,
              perf_function=self.perf_func,
          )
          # print(acc_shift, median, std_dev)
          if self.is_suspicious(before_classifier, acc_shift):
              self.is_clean_lst[idx] = 0
              report[idx] = acc_shift
          else:
              before_classifier = after_classifier
              x_trusted = np.vstack([x_trusted, x_i])
              y_trusted = np.vstack([y_trusted, y_i])
  
      return report, self.is_clean_lst
  
file_path: adversarial-robustness-toolbox/art/defences/detector/poison/roni.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  from copy import deepcopy
  from typing import Callable, List, Tuple, Union, TYPE_CHECKING
  import numpy
  from sklearn.model_selection import train_test_split
  from art.defences.detector.poison.ground_truth_evaluator import GroundTruthEvaluator
  from art.defences.detector.poison.poison_filtering_defence import PoisonFilteringDefence
  from art.utils import performance_diff
label_desc: Use image node_id 3 for calling the RONIDefense obj's underlying member method code with example usage: obj.detect_poison() and returns: report,  self