code: def isotonic_regression(
      y, sample_weight=None, y_min=None, y_max=None, increasing=True
  ):
      """Solve the isotonic regression model::
  
          min sum w[i] (y[i] - y_[i]) ** 2
  
          subject to y_min = y_[1] <= y_[2] ... <= y_[n] = y_max
  
      where:
          - y[i] are inputs (real numbers)
          - y_[i] are fitted
          - w[i] are optional strictly positive weights (default to 1.0)
  
      Read more in the :ref:`User Guide <isotonic>`.
  
      Parameters
      ----------
      y : iterable of floating-point values
          The data.
  
      sample_weight : iterable of floating-point values, optional, default: None
          Weights on each point of the regression.
          If None, weight is set to 1 (equal weights).
  
      y_min : optional, default: None
          If not None, set the lowest value of the fit to y_min.
  
      y_max : optional, default: None
          If not None, set the highest value of the fit to y_max.
  
      increasing : boolean, optional, default: True
          Whether to compute ``y_`` is increasing (if set to True) or decreasing
          (if set to False)
  
      Returns
      -------
      y_ : list of floating-point values
          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 = np.array(y[order], dtype=np.float64)
      if sample_weight is None:
          sample_weight = np.ones(len(y), dtype=np.float64)
      else:
          sample_weight = np.array(
              sample_weight[order], dtype=np.float64
          )
  
      _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 numpy
  from scipy import interpolate
  from scipy.stats import spearmanr
  from .base import BaseEstimator, TransformerMixin, RegressorMixin
  from .utils import as_float_array, check_array, check_consistent_length
  from .utils import deprecated
  from .utils.fixes import astype
  from ._isotonic import _inplace_contiguous_isotonic_regression, _make_unique
  import warnings
  import math
label_desc: Use image node_id 2 for calling a global function with example usage: isotonic_regression(y, sample_weight, y_min, y_max, increasing) and returns: y