code: def isotonic_regression(
      y, *, sample_weight=None, y_min=None, y_max=None, increasing=True
  ):
      """Solve the isotonic regression model.
  
      Read more in the :ref:`User Guide <isotonic>`.
  
      Parameters
      ----------
      y : array-like of shape (n_samples,)
          The data.
  
      sample_weight : array-like of shape (n_samples,), default=None
          Weights on each point of the regression.
          If None, weight is set to 1 (equal weights).
  
      y_min : float, default=None
          Lower bound on the lowest predicted value (the minimum value may
          still be higher). If not set, defaults to -inf.
  
      y_max : float, default=None
          Upper bound on the highest predicted value (the maximum may still be
          lower). If not set, defaults to +inf.
  
      increasing : bool, default=True
          Whether to compute ``y_`` is increasing (if set to True) or decreasing
          (if set to False).
  
      Returns
      -------
      y_ : ndarray of shape (n_samples,)
          Isotonic fit of y.
  
      References
      ----------
      "Active set algorithms for isotonic regression; A unifying framework"
      by Michael J. Best and Nilotpal Chakravarti, section 3.
      """
      order = np.s_[:] if increasing else np.s_[::-1]
      y = check_array(
          y,
          ensure_2d=False,
          input_name="y",
          dtype=[np.float64, np.float32],
      )
      y = np.array(y[order], dtype=y.dtype)
      sample_weight = _check_sample_weight(
          sample_weight, y, dtype=y.dtype, copy=True
      )
      sample_weight = np.ascontiguousarray(sample_weight[order])
  
      _inplace_contiguous_isotonic_regression(y, sample_weight)
      if y_min is not None or y_max is not None:
          # Older versions of np.clip don't accept None as a bound, so use np.inf
          if y_min is None:
              y_min = -np.inf
          if y_max is None:
              y_max = np.inf
          np.clip(y, y_min, y_max, y)
      return y[order]
  
imports: import math
  import warnings
  from numbers import Real
  import numpy
  from scipy import interpolate
  from scipy.stats import spearmanr
  from ._isotonic import _inplace_contiguous_isotonic_regression, _make_unique
  from .base import BaseEstimator, RegressorMixin, TransformerMixin, _fit_context
  from .utils import check_array, check_consistent_length
  from .utils._param_validation import Interval, StrOptions
  from .utils.validation import _check_sample_weight, check_is_fitted
label_desc: Use image node_id 2 for calling a global function with example usage: isotonic_regression(y) and returns: y