code: def test_link_inverse_identity(link, global_random_seed):
      # Test that link of inverse gives identity.
      rng = np.random.RandomState(global_random_seed)
      link = link()
      n_samples, n_classes = 100, None
      # The values for `raw_prediction` are limited from -20 to 20 because in the
      # class `LogitLink` the term `expit(x)` comes very close to 1 for large
      # positive x and therefore loses precision.
      if link.is_multiclass:
          n_classes = 10
          raw_prediction = rng.uniform(
              low=-20, high=20, size=(n_samples, n_classes)
          )
          if isinstance(link, MultinomialLogit):
              raw_prediction = link.symmetrize_raw_prediction(
                  raw_prediction
              )
      elif isinstance(link, HalfLogitLink):
          raw_prediction = rng.uniform(
              low=-10, high=10, size=(n_samples)
          )
      else:
          raw_prediction = rng.uniform(
              low=-20, high=20, size=(n_samples)
          )
  
      assert_allclose(
          link.link(link.inverse(raw_prediction)), raw_prediction
      )
      y_pred = link.inverse(raw_prediction)
      assert_allclose(link.inverse(link.link(y_pred)), y_pred)
  
file_path: scikit-learn/sklearn/_loss/tests/test_link.py
imports: import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_equal
  from sklearn._loss.link import _LINKS, HalfLogitLink, Interval, MultinomialLogit, _inclusive_low_high
label_desc: Use image node_id 3 for calling a global function with example usage: test_link_inverse_identity(link, global_random_seed) without return types