class_docstr: Implements methods performing poisoning detection based on data provenance.
  
  | Paper link: https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=8473440
class_docstr_tok: ["Implements","methods","performing","poisoning","detection","based","on","data","provenance",".","|","Paper","link",":","https",":","\/\/ieeexplore.ieee.org\/stamp\/stamp.jsp","?","tp=","&","arnumber=8473440"]
docstr: Create an :class:`.ProvenanceDefense` object with the provided classifier.
  
  :param classifier: Model evaluated for poison.
  :param x_train: dataset used to train the classifier.
  :param y_train: labels used to train the classifier.
  :param p_train: provenance features for each training data point as one hot vectors.
  :param x_val: Validation data for defense.
  :param y_val: Validation labels for defense.
  :param eps: Threshold for performance shift in suspicious data.
  :param perf_func: performance function used to evaluate effectiveness of defense.
  :param pp_valid: The percent of training data to use as validation data (for defense without validation data).
docstr_tok: ["Create","an",":","class",":","`",".ProvenanceDefense","`","object","with","the","provided","classifier",".",":","param","classifier",":","Model","evaluated","for","poison",".",":","param","x_train",":","dataset","used","to","train","the","classifier",".",":","param","y_train",":","labels","used","to","train","the","classifier",".",":","param","p_train",":","provenance","features","for","each","training","data","point","as","one","hot","vectors",".",":","param","x_val",":","Validation","data","for","defense",".",":","param","y_val",":","Validation","labels","for","defense",".",":","param","eps",":","Threshold","for","performance","shift","in","suspicious","data",".",":","param","perf_func",":","performance","function","used","to","evaluate","effectiveness","of","defense",".",":","param","pp_valid",":","The","percent","of","training","data","to","use","as","validation","data","(","for","defense","without","validation","data",")","."]
code: def __init__(
      self,
      classifier: "CLASSIFIER_TYPE",
      x_train: np.ndarray,
      y_train: np.ndarray,
      p_train: np.ndarray,
      x_val: Optional[np.ndarray] = None,
      y_val: Optional[np.ndarray] = None,
      eps: float = 0.2,
      perf_func: str = "accuracy",
      pp_valid: float = 0.2,
  ) -> None:
      """
      Create an :class:`.ProvenanceDefense` object with the provided classifier.
  
      :param classifier: Model evaluated for poison.
      :param x_train: dataset used to train the classifier.
      :param y_train: labels used to train the classifier.
      :param p_train: provenance features for each training data point as one hot vectors.
      :param x_val: Validation data for defense.
      :param y_val: Validation labels for defense.
      :param eps: Threshold for performance shift in suspicious data.
      :param perf_func: performance function used to evaluate effectiveness of defense.
      :param pp_valid: The percent of training data to use as validation data (for defense without validation data).
      """
      super().__init__(classifier, x_train, y_train)
      self.p_train = p_train
      self.num_devices = self.p_train.shape[1]
      self.x_val = x_val
      self.y_val = y_val
      self.eps = eps
      self.perf_func = perf_func
      self.pp_valid = pp_valid
      self.assigned_clean_by_device: List[np.ndarray] = []
      self.is_clean_by_device: List[np.ndarray] = []
      self.errors_by_device: Optional[np.ndarray] = None
      self.evaluator = GroundTruthEvaluator()
      self.is_clean_lst: Optional[np.ndarray] = None
      self._check_params()
  
file_path: adversarial-robustness-toolbox/art/defences/detector/poison/provenance_defense.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  from copy import deepcopy
  from typing import Dict, List, Optional, Tuple, 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 segment_by_class, performance_diff
label_desc: Use image node_id 1 to create a new ProvenanceDefense object from inherited base classes: PoisonFilteringDefence with example: obj = ProvenanceDefense(classifier, x_train, y_train, p_train, x_val, y_val, eps, perf_func, pp_valid)