class_docstr: return a logistic regression problem
  
  There is a dataset consisting of features (vectors of norm <=1)
  and labels (+1,-1), represented as a numpy array.
  There is also an L2 regularizer.
docstr: Tightest universal quadratic upper bound on the loss function.
  
  log(1+exp(x))<=log(1+exp(a))+(x-a)/(1+exp(-a))+(x-a)^2*tanh(a/2)/(4*a)
  Constant and linear terms are just first-order Taylor This function gives
  the quadratic term (which replaces the Hessian)
code: def upperbound_wor(self, param, batch_idx=None):
      """Tightest universal quadratic upper bound on the loss function.
  
      log(1+exp(x))<=log(1+exp(a))+(x-a)/(1+exp(-a))+(x-a)^2*tanh(a/2)/(4*a)
      Constant and linear terms are just first-order Taylor This function gives
      the quadratic term (which replaces the Hessian)
      """
      if batch_idx is not None:
          data_batch = self.data[batch_idx]
          batch_size = len(batch_idx)
      else:
          data_batch = self.data
          batch_size = self.num_samples
  
      temp_var = -np.dot(
          data_batch, param
      )  # vector of y_i<x_i,w> for i in [n]
      temp_var2 = np.divide(
          0.5 * np.tanh(temp_var / 2),
          temp_var,
          out=np.ones(temp_var.shape) * 0.25,
          where=np.abs(temp_var) > 1e-9,
      )
      hess_non = np.dot(data_batch.T * temp_var2, data_batch)
      return hess_non / batch_size
  
file_path: privacy/research/dp_newton/src/my_logistic_regression.py
imports: import numpy
label_desc: Use image node_id 10 for calling the MyLogisticRegression obj's underlying member method code with example usage: obj.upperbound_wor(param, batch_idx) and returns: unknown