class_docstr: Class corresponding to the regularizer in Algorithm 1 of Kifer et al.
  
  Attributes:
    l2_regularizer: scalar coefficient for l2-regularization term.
    num_train: number of training examples.
    b: tensor of shape (d,num_classes) linearly translating the objective.
class_docstr_tok: ["Class","corresponding","to","the","regularizer","in","Algorithm","1","of","Kifer","et","al",".","Attributes",":","l2_regularizer",":","scalar","coefficient","for","l2-regularization","term",".","num_train",":","number","of","training","examples",".","b",":","tensor","of","shape","(","d",",","num_classes",")","linearly","translating","the","objective","."]
docstr: Computes l2-regularization coefficient and Gaussian noise variance.
  
    The setting is based on Algorithm 1 of Kifer et al.
  
  Args:
    num_train: number of input training points.
    epsilon: epsilon parameter in (epsilon, delta)-DP.
    delta: delta parameter in (epsilon, delta)-DP.
    num_classes: number of classes.
    input_clipping_norm: l2-norm according to which input points are clipped.
  
  Returns:
    l2-regularization coefficient and variance of Gaussian noise added in
    Algorithm 1 of Kifer et al.
docstr_tok: ["Computes","l2-regularization","coefficient","and","Gaussian","noise","variance",".","The","setting","is","based","on","Algorithm","1","of","Kifer","et","al",".","Args",":","num_train",":","number","of","input","training","points",".","epsilon",":","epsilon","parameter","in","(","epsilon",",","delta",")","-DP",".","delta",":","delta","parameter","in","(","epsilon",",","delta",")","-DP",".","num_classes",":","number","of","classes",".","input_clipping_norm",":","l2-norm","according","to","which","input","points","are","clipped",".","Returns",":","l2-regularization","coefficient","and","variance","of","Gaussian","noise","added","in","Algorithm","1","of","Kifer","et","al","."]
code: def logistic_objective_perturbation_parameters(
      self,
      num_train: int,
      epsilon: float,
      delta: float,
      num_classes: int,
      input_clipping_norm: float,
  ) -> Tuple[float, float]:
      """Computes l2-regularization coefficient and Gaussian noise variance.
  
        The setting is based on Algorithm 1 of Kifer et al.
  
      Args:
        num_train: number of input training points.
        epsilon: epsilon parameter in (epsilon, delta)-DP.
        delta: delta parameter in (epsilon, delta)-DP.
        num_classes: number of classes.
        input_clipping_norm: l2-norm according to which input points are clipped.
  
      Returns:
        l2-regularization coefficient and variance of Gaussian noise added in
        Algorithm 1 of Kifer et al.
      """
      # zeta is an upper bound on the l2-norm of the loss function gradient.
      zeta = input_clipping_norm
      # variance is based on line 5 from Algorithm 1 of Kifer et al. (page 6):
      variance = (
          zeta
          * zeta
          * (8 * np.log(2 / delta) + 4 * epsilon)
          / (epsilon * epsilon)
      )
      # lambda_coefficient is an upper bound on the spectral norm of the Hessian
      # of the loss function.
      lambda_coefficient = (
          math.sqrt(2 * num_classes) * (input_clipping_norm**2) / 4
      )
      l2_regularizer = lambda_coefficient / (epsilon * num_train)
      return (l2_regularizer, variance)
  
file_path: privacy/tensorflow_privacy/privacy/logistic_regression/multinomial_logistic.py
imports: import math
  from typing import List, Optional, Tuple
  import dp_accounting
  import numpy
  import tensorflow
  from tensorflow_privacy.privacy.logistic_regression import datasets
  from tensorflow_privacy.privacy.logistic_regression import single_layer_softmax
  from tensorflow_privacy.privacy.optimizers import dp_optimizer_keras
label_desc: Use image node_id 4 for calling the KiferRegularizer obj's underlying member method code with example usage: obj.logistic_objective_perturbation_parameters(num_train, epsilon, delta, num_classes, input_clipping_norm) and returns: l2_regularizer,  variance