code: def logistic_loss(X, y, w):
      """Compute the logistic function of the data: sum(sigmoid(yXw)).
  
      Parameters
      ----------
      X : ndarray, shape (n_samples, n_features)
          Design matrix.
  
      y : ndarray, shape (n_samples,)
          Target / response vector. Each entry must be +1 or -1.
  
      w : ndarray, shape (n_features,)
          Unmasked, ravelized input map.
  
      Returns
      -------
      energy : float
          Energy contribution due to logistic data-fit term.
      """
      z = np.dot(X, w[:-1]) + w[-1]
      yz = y * z
      idx = yz > 0
      out = np.empty_like(yz)
      out[idx] = np.log1p(np.exp(-yz[idx]))
      out[~idx] = -yz[~idx] + np.log1p(np.exp(yz[~idx]))
      out = out.sum()
      return out
  
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 8 for calling a global function with example usage: logistic_loss(X, y, w) and returns: out