class_docstr: BoltOn episilon-delta differential privacy model.
  
  The privacy guarantees are dependent on the noise that is sampled. Please
  see the paper linked below for more details.
  
  Uses 4 key steps to achieve privacy guarantees:
  1. Adds noise to weights after training (output perturbation).
  2. Projects weights to R after each batch
  3. Limits learning rate
  4. Use a strongly convex loss function (see compile)
  
  For more details on the strong convexity requirements, see:
  Bolt-on Differential Privacy for Scalable Stochastic Gradient
  Descent-based Analytics by Xi Wu et al.
docstr: Fit with a generator.
  
  This method is the same as fit except for when the passed dataset
  is a generator. See super method and fit for more details.
  
  Args:
    generator: Inputs generator following Tensorflow guidelines, see super.
    class_weight: the class weights to be used. Can be a scalar or 1D tensor
      whose dim == n_classes.
    noise_distribution: the distribution to get noise from.
    epsilon: privacy parameter, which trades off utility and privacy. See
      BoltOn paper for more description.
    n_samples: number of individual samples in x
    steps_per_epoch: Number of steps per training epoch, see super.
    **kwargs: **kwargs
  
  Returns:
    Output from super fit_generator method.
docstr_tok: ["Fit","with","a","generator",".","This","method","is","the","same","as","fit","except","for","when","the","passed","dataset","is","a","generator",".","See","super","method","and","fit","for","more","details",".","Args",":","generator",":","Inputs","generator","following","Tensorflow","guidelines",",","see","super",".","class_weight",":","the","class","weights","to","be","used",".","Can","be","a","scalar","or","1D","tensor","whose","dim","==","n_classes",".","noise_distribution",":","the","distribution","to","get","noise","from",".","epsilon",":","privacy","parameter",",","which","trades","off","utility","and","privacy",".","See","BoltOn","paper","for","more","description",".","n_samples",":","number","of","individual","samples","in","x","steps_per_epoch",":","Number","of","steps","per","training","epoch",",","see","super",".","*","*","kwargs",":","*","*","kwargs","Returns",":","Output","from","super","fit_generator","method","."]
code: def fit_generator(
      self,
      generator,
      class_weight=None,
      noise_distribution="laplace",
      epsilon=2,
      n_samples=None,
      steps_per_epoch=None,
      **kwargs,
  ):  # pylint: disable=arguments-differ
      """Fit with a generator.
  
      This method is the same as fit except for when the passed dataset
      is a generator. See super method and fit for more details.
  
      Args:
        generator: Inputs generator following Tensorflow guidelines, see super.
        class_weight: the class weights to be used. Can be a scalar or 1D tensor
          whose dim == n_classes.
        noise_distribution: the distribution to get noise from.
        epsilon: privacy parameter, which trades off utility and privacy. See
          BoltOn paper for more description.
        n_samples: number of individual samples in x
        steps_per_epoch: Number of steps per training epoch, see super.
        **kwargs: **kwargs
  
      Returns:
        Output from super fit_generator method.
      """
      if class_weight is None:
          class_weight = self.calculate_class_weights(class_weight)
      if n_samples is not None:
          data_size = n_samples
      elif hasattr(generator, "shape"):
          data_size = generator.shape[0]
      elif hasattr(generator, "__len__"):
          data_size = len(generator)
      else:
          raise ValueError(
              "The number of samples could not be determined. "
              "Please make sure that if you are using a generator"
              "to call this method directly with n_samples kwarg "
              "passed."
          )
      batch_size = self._validate_or_infer_batch_size(
          None, steps_per_epoch, generator
      )
      if batch_size is None:
          batch_size = 32
      with self.optimizer(
          noise_distribution,
          epsilon,
          self.layers,
          class_weight,
          data_size,
          batch_size,
      ) as _:
          out = super(BoltOnModel, self).fit_generator(
              generator,
              class_weight=class_weight,
              steps_per_epoch=steps_per_epoch,
              **kwargs,
          )
      return out
  
file_path: privacy/tensorflow_privacy/privacy/bolt_on/models.py
imports: import tensorflow.compat.v1
  from tensorflow.compat.v1.python.framework import ops
  from tensorflow.compat.v1.python.keras import optimizers
  from tensorflow.compat.v1.python.keras.models import Model
  from tensorflow_privacy.privacy.bolt_on.losses import StrongConvexMixin
  from tensorflow_privacy.privacy.bolt_on.optimizers import BoltOn
label_desc: Use image node_id 5 for calling the BoltOnModel obj's underlying member method code with example usage: obj.fit_generator(generator, class_weight, noise_distribution, epsilon, n_samples, steps_per_epoch) and returns: out