code: def _logistic_derivative_lipschitz_constant(
      X, mask, grad_weight, n_iterations=100
  ):
      """Compute the lipschitz constant of the gradient of the smooth part \
      of the Graph-Net classification problem (logistic_loss + \
      grad_weight*grad) via analytical formula on the logistic loss + \
      power method on the smooth part."""
      # L. constant for the data term (logistic)
      # data_constant = sp.linalg.norm(X, 2) ** 2
      data_constant = logistic_loss_lipschitz_constant(X)
  
      rng = np.random.RandomState(42)
      a = rng.randn(X.shape[1])
      a /= sqrt(np.dot(a, a))
      grad_buffer = np.zeros(mask.shape)
      for _ in range(n_iterations):
          grad_buffer[mask] = a
          a = -divergence(gradient(grad_buffer))[mask] / sqrt(
              np.dot(a, a)
          )
  
      grad_buffer[mask] = a
      grad_constant = -np.dot(
          divergence(gradient(grad_buffer))[mask], a
      ) / np.dot(a, a)
  
      return data_constant + grad_weight * grad_constant
  
file_path: nilearn/nilearn/decoding/space_net_solvers.py
imports: from math import sqrt
  import numpy
  from nilearn.masking import unmask_from_to_3d_array
  from ._objective_functions import divergence, gradient, gradient_id, logistic_loss, logistic_loss_grad, logistic_loss_lipschitz_constant, spectral_norm_squared, squared_loss, squared_loss_grad
  from ._proximal_operators import prox_l1, prox_l1_with_intercept, prox_tvl1, prox_tvl1_with_intercept
  from .fista import mfista
label_desc: Use image node_id 6 for calling a global function with example usage: _logistic_derivative_lipschitz_constant(X, mask, grad_weight, n_iterations) and returns: unknown