code: def test_binomial_and_multinomial_loss(global_random_seed):
      """Test that multinomial loss with n_classes = 2 is the same as binomial loss."""
      rng = np.random.RandomState(global_random_seed)
      n_samples = 20
      binom = HalfBinomialLoss()
      multinom = HalfMultinomialLoss(n_classes=2)
      y_train = rng.randint(0, 2, size=n_samples).astype(np.float64)
      raw_prediction = rng.normal(size=n_samples)
      raw_multinom = np.empty((n_samples, 2))
      raw_multinom[:, 0] = -0.5 * raw_prediction
      raw_multinom[:, 1] = 0.5 * raw_prediction
      assert_allclose(
          binom.loss(y_true=y_train, raw_prediction=raw_prediction),
          multinom.loss(y_true=y_train, raw_prediction=raw_multinom),
      )
  
imports: import pickle
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_equal
  from pytest import approx
  from scipy.optimize import LinearConstraint, minimize, minimize_scalar, newton
  from scipy.special import logsumexp
  from sklearn._loss.link import IdentityLink, _inclusive_low_high
  from sklearn._loss.loss import _LOSSES, AbsoluteError, BaseLoss, HalfBinomialLoss, HalfGammaLoss, HalfMultinomialLoss, HalfPoissonLoss, HalfSquaredError, HalfTweedieLoss, HalfTweedieLossIdentity, HuberLoss, PinballLoss
  from sklearn.utils import _IS_WASM, assert_all_finite
  from sklearn.utils._testing import create_memmap_backed_data, skip_if_32bit
label_desc: Use image node_id 19 for calling a global function with example usage: test_binomial_and_multinomial_loss(global_random_seed) without return types