bqlearn.corruptions.make_instance_dependent_label_noise¶
- bqlearn.corruptions.make_instance_dependent_label_noise(noise_prob, y, noise_matrix='uniform', *, random_state=None, labels=None)[source]¶
Corrupt the labels given a noise transition matrix and a noise probability function.
- Parameters:
- noise_probarray-like of shape (n_samples, )
The noise probabilities.
- yarray-like of shape (n_samples, )
The targets.
- noise_matrixstr or callable, 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. If noise_matrix is a callable, it should take a number of classes, a noise probability, and optionally a random state as the input and outputs a numpy array of shape (n_classes, n_classes).
- 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
Noneis given, those that appear at least once inyand are used in sorted order.
- Returns:
- y_corruptndarray of shape (n_samples,)
The corrupted targets.