class_docstr: Isotonic regression model.
  
  Read more in the :ref:`User Guide <isotonic>`.
  
  .. versionadded:: 0.13
  
  Parameters
  ----------
  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 or 'auto', default=True
      Determines whether the predictions should be constrained to increase
      or decrease with `X`. 'auto' will decide based on the Spearman
      correlation estimate's sign.
  
  out_of_bounds : {'nan', 'clip', 'raise'}, default='nan'
      Handles how `X` values outside of the training domain are handled
      during prediction.
  
      - 'nan', predictions will be NaN.
      - 'clip', predictions will be set to the value corresponding to
        the nearest train interval endpoint.
      - 'raise', a `ValueError` is raised.
  
  Attributes
  ----------
  X_min_ : float
      Minimum value of input array `X_` for left bound.
  
  X_max_ : float
      Maximum value of input array `X_` for right bound.
  
  X_thresholds_ : ndarray of shape (n_thresholds,)
      Unique ascending `X` values used to interpolate
      the y = f(X) monotonic function.
  
      .. versionadded:: 0.24
  
  y_thresholds_ : ndarray of shape (n_thresholds,)
      De-duplicated `y` values suitable to interpolate the y = f(X)
      monotonic function.
  
      .. versionadded:: 0.24
  
  f_ : function
      The stepwise interpolating function that covers the input domain ``X``.
  
  increasing_ : bool
      Inferred value for ``increasing``.
  
  See Also
  --------
  sklearn.linear_model.LinearRegression : Ordinary least squares Linear
      Regression.
  sklearn.ensemble.HistGradientBoostingRegressor : Gradient boosting that
      is a non-parametric model accepting monotonicity constraints.
  isotonic_regression : Function to solve the isotonic regression model.
  
  Notes
  -----
  Ties are broken using the secondary method from de Leeuw, 1977.
  
  References
  ----------
  Isotonic Median Regression: A Linear Programming Approach
  Nilotpal Chakravarti
  Mathematics of Operations Research
  Vol. 14, No. 2 (May, 1989), pp. 303-308
  
  Isotone Optimization in R : Pool-Adjacent-Violators
  Algorithm (PAVA) and Active Set Methods
  de Leeuw, Hornik, Mair
  Journal of Statistical Software 2009
  
  Correctness of Kruskal's algorithms for monotone regression with ties
  de Leeuw, Psychometrica, 1977
  
  Examples
  --------
  >>> from sklearn.datasets import make_regression
  >>> from sklearn.isotonic import IsotonicRegression
  >>> X, y = make_regression(n_samples=10, n_features=1, random_state=41)
  >>> iso_reg = IsotonicRegression().fit(X, y)
  >>> iso_reg.predict([.1, .2])
  array([1.8628..., 3.7256...])
docstr: Build the y_ IsotonicRegression.
docstr_tok: ["Build","the","y_","IsotonicRegression","."]
code: def _build_y(self, X, y, sample_weight, trim_duplicates=True):
      """Build the y_ IsotonicRegression."""
      self._check_input_data_shape(X)
      X = X.reshape(-1)  # use 1d view
  
      # Determine increasing if auto-determination requested
      if self.increasing == "auto":
          self.increasing_ = check_increasing(X, y)
      else:
          self.increasing_ = self.increasing
  
      # If sample_weights is passed, removed zero-weight values and clean
      # order
      sample_weight = _check_sample_weight(
          sample_weight, X, dtype=X.dtype
      )
      mask = sample_weight > 0
      X, y, sample_weight = X[mask], y[mask], sample_weight[mask]
  
      order = np.lexsort((y, X))
      X, y, sample_weight = [
          array[order] for array in [X, y, sample_weight]
      ]
      unique_X, unique_y, unique_sample_weight = _make_unique(
          X, y, sample_weight
      )
  
      X = unique_X
      y = isotonic_regression(
          unique_y,
          sample_weight=unique_sample_weight,
          y_min=self.y_min,
          y_max=self.y_max,
          increasing=self.increasing_,
      )
  
      # Handle the left and right bounds on X
      self.X_min_, self.X_max_ = np.min(X), np.max(X)
  
      if trim_duplicates:
          # Remove unnecessary points for faster prediction
          keep_data = np.ones((len(y),), dtype=bool)
          # Aside from the 1st and last point, remove points whose y values
          # are equal to both the point before and the point after it.
          keep_data[1:-1] = np.logical_or(
              np.not_equal(y[1:-1], y[:-2]),
              np.not_equal(y[1:-1], y[2:]),
          )
          return X[keep_data], y[keep_data]
      else:
          # The ability to turn off trim_duplicates is only used to it make
          # easier to unit test that removing duplicates in y does not have
          # any impact the resulting interpolation function (besides
          # prediction speed).
          return X, y
  
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 4 for calling the IsotonicRegression obj's underlying member method code with example usage: obj._build_y(X, y, sample_weight, trim_duplicates) and returns: X,  y, X,  y