code: def logistic_objective_perturbation(
      train_dataset: datasets.RegressionDataset,
      test_dataset: datasets.RegressionDataset,
      epsilon: float,
      delta: float,
      epochs: int,
      num_classes: int,
      input_clipping_norm: float,
  ) -> List[float]:
      """Trains and validates differentially private logistic regression model.
  
        The training is based on the Algorithm 1 of Kifer et al.
  
      Args:
        train_dataset: consists of num_train many labeled examples, where the labels
          are in {0,1,...,num_classes-1}.
        test_dataset: consists of num_test many labeled examples, where the labels
          are in {0,1,...,num_classes-1}.
        epsilon: epsilon parameter in (epsilon, delta)-DP.
        delta: delta parameter in (epsilon, delta)-DP.
        epochs: number of training epochs.
        num_classes: number of classes.
        input_clipping_norm: l2-norm according to which input points are clipped.
  
      Returns:
        List of test accuracies (one for each epoch) on test_dataset of model
        trained on train_dataset.
      """
      num_train, dimension = train_dataset.points.shape
      # Normalize each training point (i.e., row of train_dataset.points) to have
      # l2-norm at most input_clipping_norm.
      train_dataset.points = tf.clip_by_norm(
          train_dataset.points, input_clipping_norm, [1]
      ).numpy()
      optimizer = "sgd"
      loss = "categorical_crossentropy"
      kernel_regularizer = KiferRegularizer(
          num_train,
          dimension,
          epsilon,
          delta,
          num_classes,
          input_clipping_norm,
      )
      return single_layer_softmax.single_layer_softmax_classifier(
          train_dataset,
          test_dataset,
          epochs,
          num_classes,
          optimizer,
          loss,
          kernel_regularizer=kernel_regularizer,
      )
  
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 1 for calling a global function with example usage: logistic_objective_perturbation(train_dataset, test_dataset, epsilon, delta, epochs, num_classes, input_clipping_norm) and returns: single_layer_softmax