class_docstr: Implementation of Bullseye Polytope Attack by Aghakhani, et. al. 2020.
  "Bullseye Polytope: A Scalable Clean-Label Poisoning Attack with Improved Transferability"
  
  This implementation is based on UCSB's original code here: https://github.com/ucsb-seclab/BullseyePoison
  
  | Paper link: https://arxiv.org/abs/2005.00191
class_docstr_tok: ["Implementation","of","Bullseye","Polytope","Attack","by","Aghakhani",",","et",".","al",".","2020",".","``","Bullseye","Polytope",":","A","Scalable","Clean-Label","Poisoning","Attack","with","Improved","Transferability","''","This","implementation","is","based","on","UCSB","'s","original","code","here",":","https",":","\/\/github.com\/ucsb-seclab\/BullseyePoison","|","Paper","link",":","https",":","\/\/arxiv.org\/abs\/2005.00191"]
docstr: Initialize an Feature Collision Clean-Label poisoning attack
  
  :param classifier: The proxy classifiers used for the attack. Can be a single classifier or list of classifiers
                     with varying architectures.
  :param target: The target input(s) of shape (N, W, H, C) to misclassify at test time. Multiple targets will be
                 averaged.
  :param feature_layer: The name(s) of the feature representation layer(s).
  :param opt: The optimizer to use for the attack. Can be 'adam' or 'sgd'
  :param max_iter: The maximum number of iterations for the attack.
  :param learning_rate: The learning rate of clean-label attack optimization.
  :param momentum: The momentum of clean-label attack optimization.
  :param decay_iter: Which iterations to decay the learning rate.
                     Can be a integer (every N iterations) or list of integers [0, 500, 1500]
  :param decay_coeff: The decay coefficient of the learning rate.
  :param epsilon: The perturbation budget
  :param dropout: Dropout to apply while training
  :param net_repeat: The number of times to repeat prediction on each network
  :param endtoend: True for end-to-end training. False for transfer learning.
  :param batch_size: Batch size.
  :param verbose: Show progress bars.
docstr_tok: ["Initialize","an","Feature","Collision","Clean-Label","poisoning","attack",":","param","classifier",":","The","proxy","classifiers","used","for","the","attack",".","Can","be","a","single","classifier","or","list","of","classifiers","with","varying","architectures",".",":","param","target",":","The","target","input","(","s",")","of","shape","(","N",",","W",",","H",",","C",")","to","misclassify","at","test","time",".","Multiple","targets","will","be","averaged",".",":","param","feature_layer",":","The","name","(","s",")","of","the","feature","representation","layer","(","s",")",".",":","param","opt",":","The","optimizer","to","use","for","the","attack",".","Can","be","'adam","'","or","'sgd'",":","param","max_iter",":","The","maximum","number","of","iterations","for","the","attack",".",":","param","learning_rate",":","The","learning","rate","of","clean-label","attack","optimization",".",":","param","momentum",":","The","momentum","of","clean-label","attack","optimization",".",":","param","decay_iter",":","Which","iterations","to","decay","the","learning","rate",".","Can","be","a","integer","(","every","N","iterations",")","or","list","of","integers","[","0",",","500",",","1500","]",":","param","decay_coeff",":","The","decay","coefficient","of","the","learning","rate",".",":","param","epsilon",":","The","perturbation","budget",":","param","dropout",":","Dropout","to","apply","while","training",":","param","net_repeat",":","The","number","of","times","to","repeat","prediction","on","each","network",":","param","endtoend",":","True","for","end-to-end","training",".","False","for","transfer","learning",".",":","param","batch_size",":","Batch","size",".",":","param","verbose",":","Show","progress","bars","."]
code: def __init__(
      self,
      classifier: Union[
          "CLASSIFIER_NEURALNETWORK_TYPE",
          List["CLASSIFIER_NEURALNETWORK_TYPE"],
      ],
      target: np.ndarray,
      feature_layer: Union[Union[str, int], List[Union[str, int]]],
      opt: str = "adam",
      max_iter: int = 4000,
      learning_rate: float = 4e-2,
      momentum: float = 0.9,
      decay_iter: Union[int, List[int]] = 10000,
      decay_coeff: float = 0.5,
      epsilon: float = 0.1,
      dropout: float = 0.3,
      net_repeat: int = 1,
      endtoend: bool = True,
      batch_size: int = 128,
      verbose: bool = True,
  ):
      """
      Initialize an Feature Collision Clean-Label poisoning attack
  
      :param classifier: The proxy classifiers used for the attack. Can be a single classifier or list of classifiers
                         with varying architectures.
      :param target: The target input(s) of shape (N, W, H, C) to misclassify at test time. Multiple targets will be
                     averaged.
      :param feature_layer: The name(s) of the feature representation layer(s).
      :param opt: The optimizer to use for the attack. Can be 'adam' or 'sgd'
      :param max_iter: The maximum number of iterations for the attack.
      :param learning_rate: The learning rate of clean-label attack optimization.
      :param momentum: The momentum of clean-label attack optimization.
      :param decay_iter: Which iterations to decay the learning rate.
                         Can be a integer (every N iterations) or list of integers [0, 500, 1500]
      :param decay_coeff: The decay coefficient of the learning rate.
      :param epsilon: The perturbation budget
      :param dropout: Dropout to apply while training
      :param net_repeat: The number of times to repeat prediction on each network
      :param endtoend: True for end-to-end training. False for transfer learning.
      :param batch_size: Batch size.
      :param verbose: Show progress bars.
      """
      self.subsistute_networks: List[
          "CLASSIFIER_NEURALNETWORK_TYPE"
      ] = (
          [classifier]
          if not isinstance(classifier, list)
          else classifier
      )
  
      super().__init__(classifier=self.subsistute_networks[0])  # type: ignore
      self.target = target
      self.opt = opt
      self.momentum = momentum
      self.decay_iter = decay_iter
      self.epsilon = epsilon
      self.dropout = dropout
      self.net_repeat = net_repeat
      self.endtoend = endtoend
      self.feature_layer = feature_layer
      self.learning_rate = learning_rate
      self.decay_coeff = decay_coeff
      self.max_iter = max_iter
      self.batch_size = batch_size
      self.verbose = verbose
      self._check_params()
  
file_path: adversarial-robustness-toolbox/art/attacks/poisoning/bullseye_polytope_attack.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  import time
  from typing import Optional, Tuple, Union, TYPE_CHECKING, List
  import numpy
  from tqdm.auto import trange
  from art.attacks.attack import PoisoningAttackWhiteBox
  from art.estimators import BaseEstimator, NeuralNetworkMixin
  from art.estimators.classification.classifier import ClassifierMixin
  from art.estimators.classification.pytorch import PyTorchClassifier
label_desc: Use image node_id 1 to create a new BullseyePolytopeAttackPyTorch object from inherited base classes: PoisoningAttackWhiteBox with example: obj = BullseyePolytopeAttackPyTorch(classifier, target, feature_layer, opt, max_iter, learning_rate, momentum, decay_iter, decay_coeff, epsilon, dropout, net_repeat, endtoend, batch_size, verbose)