code: def logistic_loss_grad(X, y, w):
      """Compute the derivative of logistic."""
      z = np.dot(X, w[:-1]) + w[-1]
      yz = y * z
      z = _sigmoid(yz, copy=False)
      z0 = (z - 1.0) * y
      grad = np.empty(w.shape)
      grad[:-1] = np.dot(X.T, z0)
      grad[-1] = np.sum(z0)
      return grad
  
file_path: nilearn/nilearn/decoding/_objective_functions.py
imports: from functools import partial
  import numpy
  from scipy import linalg
label_desc: Use image node_id 9 for calling a global function with example usage: logistic_loss_grad(X, y, w) and returns: grad