bqlearn.corruptions.make_label_noise

bqlearn.corruptions.make_label_noise(y, noise_matrix='uniform', *, noise_ratio=0.5, random_state=None, labels=None)[source]

Corrupt the labels given a noise transition matrix.

Parameters:
yarray-like of shape (n_samples, )

The targets.

noise_matrixstr or array-like of shape (n_classes, n_classes), default=”uniform”

The matrix representing probabilities transition between clean labels and noisy labels. If noise_matrix is a string, it must be one of the metrics in noise_matrices.NOISE_MATRIX_FUNCTIONS.

noise_ratiofloat, default=0.5

The ratio of noise. Must be between 0 and 1. Not used if noise_matrix is an array-like.

random_stateint or RandomState, default=None

Controls the noise matrix construction.

labelsarray-like of shape (n_classes), default=None

List of labels to index the matrix. This may be used to reorder or select a subset of labels. If None is given, those that appear at least once in y and are used in sorted order.

Returns:
y_corruptndarray of shape (n_samples,)

The corrupted targets.