code: def test_logistic_loss_derivative(
      rng, n_samples=4, n_features=10, decimal=5
  ):
      X = rng.standard_normal((n_samples, n_features))
      y = rng.standard_normal(n_samples)
      n_features = X.shape[1]
      w = rng.standard_normal(n_features + 1)
      assert_almost_equal(
          check_grad(
              lambda w: logistic_loss(X, y, w),
              lambda w: logistic_loss_grad(X, y, w),
              w,
          ),
          0.0,
          decimal=decimal,
      )
  
file_path: nilearn/nilearn/decoding/tests/test_objective_functions.py
imports: import numpy
  import pytest
  from numpy.testing import assert_almost_equal, assert_array_equal
  from scipy.optimize import check_grad
  from nilearn.decoding._objective_functions import divergence_id, gradient_id, logistic_loss, logistic_loss_grad
  from nilearn.decoding.space_net import BaseSpaceNet
label_desc: Use image node_id 5 for calling a global function with example usage: test_logistic_loss_derivative(rng, n_samples, n_features, decimal) without return types