sliced.base.slice_y

sliced.base.slice_y(y, n_slices=10)[source]

Determine non-overlapping slices based on the target variable, y.

Parameters:
y : array_like, shape (n_samples,)

The target values (class labels in classification, real numbers in regression).

n_slices : int (default=10)

The number of slices used when calculating the inverse regression curve. Truncated to at most the number of unique values of y.

Returns:
slice_indicator : ndarray, shape (n_samples,)

Index of the slice (from 0 to n_slices) that contains this observation.

slice_counts : ndarray, shape (n_slices,)

The number of counts in each slice.