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: Reroutes to super fit with  BoltOn delta-epsilon privacy requirements.
  
  Note, inputs must be normalized s.t. ||x|| < 1.
  Requirements are as follows:
    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)
  See super implementation for more details.
  
  Args:
    x: Inputs to fit on, see super.
    y: Labels to fit on, see super.
    batch_size: The batch size to use for training, see super.
    class_weight: the class weights to be used. Can be a scalar or 1D tensor
      whose dim == n_classes.
    n_samples: the number of individual samples in x.
    epsilon: privacy parameter, which trades off between utility an privacy.
      See the bolt-on paper for more description.
    noise_distribution: the distribution to pull noise from.
    steps_per_epoch:
    **kwargs: kwargs to keras Model.fit. See super.
  
  Returns:
    Output from super fit method.
docstr_tok: ["Reroutes","to","super","fit","with","BoltOn","delta-epsilon","privacy","requirements",".","Note",",","inputs","must","be","normalized","s.t",".","||x||","<","1",".","Requirements","are","as","follows",":","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",")","See","super","implementation","for","more","details",".","Args",":","x",":","Inputs","to","fit","on",",","see","super",".","y",":","Labels","to","fit","on",",","see","super",".","batch_size",":","The","batch","size","to","use","for","training",",","see","super",".","class_weight",":","the","class","weights","to","be","used",".","Can","be","a","scalar","or","1D","tensor","whose","dim","==","n_classes",".","n_samples",":","the","number","of","individual","samples","in","x.","epsilon",":","privacy","parameter",",","which","trades","off","between","utility","an","privacy",".","See","the","bolt-on","paper","for","more","description",".","noise_distribution",":","the","distribution","to","pull","noise","from",".","steps_per_epoch",":","*","*","kwargs",":","kwargs","to","keras","Model.fit",".","See","super",".","Returns",":","Output","from","super","fit","method","."]
code: def fit(
      self,
      x=None,
      y=None,
      batch_size=None,
      class_weight=None,
      n_samples=None,
      epsilon=2,
      noise_distribution="laplace",
      steps_per_epoch=None,
      **kwargs,
  ):  # pylint: disable=arguments-differ
      """Reroutes to super fit with  BoltOn delta-epsilon privacy requirements.
  
      Note, inputs must be normalized s.t. ||x|| < 1.
      Requirements are as follows:
        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)
      See super implementation for more details.
  
      Args:
        x: Inputs to fit on, see super.
        y: Labels to fit on, see super.
        batch_size: The batch size to use for training, see super.
        class_weight: the class weights to be used. Can be a scalar or 1D tensor
          whose dim == n_classes.
        n_samples: the number of individual samples in x.
        epsilon: privacy parameter, which trades off between utility an privacy.
          See the bolt-on paper for more description.
        noise_distribution: the distribution to pull noise from.
        steps_per_epoch:
        **kwargs: kwargs to keras Model.fit. See super.
  
      Returns:
        Output from super fit method.
      """
      if class_weight is None:
          class_weight_ = self.calculate_class_weights(class_weight)
      else:
          class_weight_ = class_weight
      if n_samples is not None:
          data_size = n_samples
      elif hasattr(x, "shape"):
          data_size = x.shape[0]
      elif hasattr(x, "__len__"):
          data_size = len(x)
      else:
          data_size = None
      batch_size_ = self._validate_or_infer_batch_size(
          batch_size, steps_per_epoch, x
      )
      if batch_size_ is None:
          batch_size_ = 32
      # inferring batch_size to be passed to optimizer. batch_size must remain its
      # initial value when passed to super().fit()
      if batch_size_ is None:
          raise ValueError(
              "batch_size: {0} is an "
              "invalid value".format(batch_size_)
          )
      if data_size is None:
          raise ValueError(
              "Could not infer the number of samples. Please pass "
              "this in using n_samples."
          )
      with self.optimizer(
          noise_distribution,
          epsilon,
          self.layers,
          class_weight_,
          data_size,
          batch_size_,
      ) as _:
          out = super(BoltOnModel, self).fit(
              x=x,
              y=y,
              batch_size=batch_size,
              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 4 for calling the BoltOnModel obj's underlying member method code with example usage: obj.fit(x, y, batch_size, class_weight, n_samples, epsilon, noise_distribution, steps_per_epoch) and returns: out