class_docstr: Class performing adversarial training following Madry's Protocol.
  
  | Paper link: https://arxiv.org/abs/1706.06083
  
  | Please keep in mind the limitations of defences. While adversarial training is widely regarded as a promising,
      principled approach to making classifiers more robust (see https://arxiv.org/abs/1802.00420), very careful
      evaluations are required to assess its effectiveness case by case (see https://arxiv.org/abs/1902.06705).
class_docstr_tok: ["Class","performing","adversarial","training","following","Madry","'s","Protocol",".","|","Paper","link",":","https",":","\/\/arxiv.org\/abs\/1706.06083","|","Please","keep","in","mind","the","limitations","of","defences",".","While","adversarial","training","is","widely","regarded","as","a","promising",",","principled","approach","to","making","classifiers","more","robust","(","see","https",":","\/\/arxiv.org\/abs\/1802.00420",")",",","very","careful","evaluations","are","required","to","assess","its","effectiveness","case","by","case","(","see","https",":","\/\/arxiv.org\/abs\/1902.06705",")","."]
docstr: Train a model adversarially. See class documentation for more information on the exact procedure.
  
  :param x: Training data.
  :param y: Labels for the training data.
  :param validation_data: Validation data.
  :param batch_size: Size of batches. Overwrites batch_size defined in __init__ if not None.
  :param nb_epochs: Number of epochs to use for trainings. Overwrites nb_epochs defined in __init__ if not None.
  :param kwargs: Dictionary of framework-specific arguments.
docstr_tok: ["Train","a","model","adversarially",".","See","class","documentation","for","more","information","on","the","exact","procedure",".",":","param","x",":","Training","data",".",":","param","y",":","Labels","for","the","training","data",".",":","param","validation_data",":","Validation","data",".",":","param","batch_size",":","Size","of","batches",".","Overwrites","batch_size","defined","in","__init__","if","not","None",".",":","param","nb_epochs",":","Number","of","epochs","to","use","for","trainings",".","Overwrites","nb_epochs","defined","in","__init__","if","not","None",".",":","param","kwargs",":","Dictionary","of","framework-specific","arguments","."]
code: def fit(  # pylint: disable=W0221
      self,
      x: np.ndarray,
      y: np.ndarray,
      validation_data: Optional[np.ndarray] = None,
      batch_size: Optional[int] = None,
      nb_epochs: Optional[int] = None,
      **kwargs,
  ) -> None:
      """
      Train a model adversarially. See class documentation for more information on the exact procedure.
  
      :param x: Training data.
      :param y: Labels for the training data.
      :param validation_data: Validation data.
      :param batch_size: Size of batches. Overwrites batch_size defined in __init__ if not None.
      :param nb_epochs: Number of epochs to use for trainings. Overwrites nb_epochs defined in __init__ if not None.
      :param kwargs: Dictionary of framework-specific arguments.
      """
      batch_size_fit: int
      if batch_size is not None:
          batch_size_fit = batch_size
      elif self.batch_size is not None:
          batch_size_fit = self.batch_size
      else:
          raise ValueError("Please provide value for `batch_size`.")
  
      if nb_epochs is not None:
          nb_epochs_fit: int = nb_epochs
      elif self.nb_epochs is not None:
          nb_epochs_fit = self.nb_epochs
      else:
          raise ValueError("Please provide value for `nb_epochs`.")
  
      self.trainer.fit(
          x,
          y,
          validation_data=validation_data,
          nb_epochs=nb_epochs_fit,
          batch_size=batch_size_fit,
          **kwargs,
      )
  
file_path: adversarial-robustness-toolbox/art/defences/trainer/adversarial_trainer_madry_pgd.py
imports: import logging
  from typing import Optional, Union, TYPE_CHECKING
  import numpy
  from art.defences.trainer.trainer import Trainer
  from art.defences.trainer.adversarial_trainer import AdversarialTrainer
  from art.attacks.evasion.projected_gradient_descent.projected_gradient_descent import ProjectedGradientDescent
label_desc: Use image node_id 2 for calling the AdversarialTrainerMadryPGD obj's underlying member method code with example usage: obj.fit(x, y, validation_data, batch_size, nb_epochs) without return types