class_docstr: This class implements the evaluation of Security Curves.
  
  Examples of Security Curves can be found in Figure 6 of Madry et al., 2017 (https://arxiv.org/abs/1706.06083).
class_docstr_tok: ["This","class","implements","the","evaluation","of","Security","Curves",".","Examples","of","Security","Curves","can","be","found","in","Figure","6","of","Madry","et","al.",",","2017","(","https",":","\/\/arxiv.org\/abs\/1706.06083",")","."]
docstr: Evaluate the Security Curve of a classifier using Projected Gradient Descent.
  
  :param classifier: A trained classifier that provides loss gradients.
  :param x: Input data to classifier for evaluation.
  :param y: True labels for input data `x`.
  :param kwargs: Keyword arguments for the Projected Gradient Descent attack used for evaluation, except keywords
                 `classifier` and `eps`.
  :return: List of evaluated `eps` values, List of adversarial accuracies, and benign accuracy.
docstr_tok: ["Evaluate","the","Security","Curve","of","a","classifier","using","Projected","Gradient","Descent",".",":","param","classifier",":","A","trained","classifier","that","provides","loss","gradients",".",":","param","x",":","Input","data","to","classifier","for","evaluation",".",":","param","y",":","True","labels","for","input","data","`","x","`",".",":","param","kwargs",":","Keyword","arguments","for","the","Projected","Gradient","Descent","attack","used","for","evaluation",",","except","keywords","`","classifier","`","and","`","eps","`",".",":","return",":","List","of","evaluated","`","eps","`","values",",","List","of","adversarial","accuracies",",","and","benign","accuracy","."]
code: def evaluate(  # type: ignore
      self,
      classifier: "CLASSIFIER_LOSS_GRADIENTS_TYPE",
      x: np.ndarray,
      y: np.ndarray,
      **kwargs: Union[str, bool, int, float],
  ) -> Tuple[List[float], List[float], float]:
      """
      Evaluate the Security Curve of a classifier using Projected Gradient Descent.
  
      :param classifier: A trained classifier that provides loss gradients.
      :param x: Input data to classifier for evaluation.
      :param y: True labels for input data `x`.
      :param kwargs: Keyword arguments for the Projected Gradient Descent attack used for evaluation, except keywords
                     `classifier` and `eps`.
      :return: List of evaluated `eps` values, List of adversarial accuracies, and benign accuracy.
      """
  
      kwargs.pop("classifier", None)
      kwargs.pop("eps", None)
      self.eps_list.clear()
      self.accuracy_adv_list.clear()
      self.accuracy = None
  
      # Check type of eps
      if isinstance(self.eps, int):
          if classifier.clip_values is not None:
              eps_increment = (
                  classifier.clip_values[1] - classifier.clip_values[0]
              ) / self.eps
          else:
              eps_increment = (np.max(x) - np.min(x)) / self.eps
  
          for i in range(1, self.eps + 1):
              self.eps_list.append(float(i * eps_increment))
  
      else:
          self.eps_list = [float(eps) for eps in self.eps]
  
      # Determine benign accuracy
      y_pred = classifier.predict(x=x, y=y)
      self.accuracy = self._get_accuracy(y=y, y_pred=y_pred)
  
      # Determine adversarial accuracy for each eps
      for eps in self.eps_list:
          attack_pgd = ProjectedGradientDescent(estimator=classifier, eps=eps, **kwargs)  # type: ignore
  
          x_adv = attack_pgd.generate(x=x, y=y)
  
          y_pred_adv = classifier.predict(x=x_adv, y=y)
          accuracy_adv = self._get_accuracy(y=y, y_pred=y_pred_adv)
          self.accuracy_adv_list.append(accuracy_adv)
  
      # Check gradients for potential obfuscation
      self._check_gradient(classifier=classifier, x=x, y=y, **kwargs)
  
      return self.eps_list, self.accuracy_adv_list, self.accuracy
  
file_path: adversarial-robustness-toolbox/art/evaluations/security_curve/security_curve.py
imports: from typing import List, Optional, Tuple, TYPE_CHECKING, Union
  import numpy
  from art.evaluations.evaluation import Evaluation
  from art.attacks.evasion.projected_gradient_descent.projected_gradient_descent import ProjectedGradientDescent
label_desc: Use image node_id 2 for calling the SecurityCurve obj's underlying member method code with example usage: obj.evaluate(classifier, x, y) and returns: self,  self,  self