code: def test_fast_predict():
      # test that the faster prediction change doesn't
      # affect out-of-sample predictions:
      # https://github.com/scikit-learn/scikit-learn/pull/6206
      rng = np.random.RandomState(123)
      n_samples = 10**3
      # X values over the -10,10 range
      X_train = 20.0 * rng.rand(n_samples) - 10
      y_train = (
          np.less(rng.rand(n_samples), expit(X_train))
          .astype("int64")
          .astype("float64")
      )
  
      weights = rng.rand(n_samples)
      # we also want to test that everything still works when some weights are 0
      weights[rng.rand(n_samples) < 0.1] = 0
  
      slow_model = IsotonicRegression(
          y_min=0, y_max=1, out_of_bounds="clip"
      )
      fast_model = IsotonicRegression(
          y_min=0, y_max=1, out_of_bounds="clip"
      )
  
      # Build interpolation function with ALL input data, not just the
      # non-redundant subset. The following 2 lines are taken from the
      # .fit() method, without removing unnecessary points
      X_train_fit, y_train_fit = slow_model._build_y(
          X_train, y_train, sample_weight=weights, trim_duplicates=False
      )
      slow_model._build_f(X_train_fit, y_train_fit)
  
      # fit with just the necessary data
      fast_model.fit(X_train, y_train, sample_weight=weights)
  
      X_test = 20.0 * rng.rand(n_samples) - 10
      y_pred_slow = slow_model.predict(X_test)
      y_pred_fast = fast_model.predict(X_test)
  
      assert_array_equal(y_pred_slow, y_pred_fast)
  
imports: import copy
  import pickle
  import warnings
  import numpy
  import pytest
  from scipy.special import expit
  import sklearn
  from sklearn.datasets import make_regression
  from sklearn.isotonic import IsotonicRegression, _make_unique, check_increasing, isotonic_regression
  from sklearn.utils import shuffle
  from sklearn.utils._testing import assert_allclose, assert_array_almost_equal, assert_array_equal
  from sklearn.utils.validation import check_array
label_desc: Use image node_id 27 for calling a global function with example usage: test_fast_predict() without return types