'Build the y_ IsotonicRegression.'

def _build_y(self, X, y, sample_weight, trim_duplicates=True):

    check_consistent_length(X, y, sample_weight)
    (X, y) = [check_array(x, ensure_2d=False) for x in [X, y]]
    y = as_float_array(y)
    self._check_fit_data(X, y, sample_weight)
    if (self.increasing == 'auto'):
        self.increasing_ = check_increasing(X, y)
    else:
        self.increasing_ = self.increasing
    if (sample_weight is not None):
        sample_weight = check_array(sample_weight, ensure_2d=False)
        mask = (sample_weight > 0)
        (X, y, sample_weight) = (X[mask], y[mask], sample_weight[mask])
    else:
        sample_weight = np.ones(len(y))
    order = np.lexsort((y, X))
    (X, y, sample_weight) = [array[order].astype(np.float64, copy=False) for array in [X, y, sample_weight]]
    (unique_X, unique_y, unique_sample_weight) = _make_unique(X, y, sample_weight)
    self._X_ = X = unique_X
    self._y_ = y = isotonic_regression(unique_y, unique_sample_weight, self.y_min, self.y_max, increasing=self.increasing_)
    (self.X_min_, self.X_max_) = (np.min(X), np.max(X))
    if trim_duplicates:
        keep_data = np.ones((len(y),), dtype=bool)
        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:
        return (X, y)
