Learning With Noisy Labels
Label Smoothing: Soften hard labels
def label_smoothing(y, num_classes, epsilon=0.1):
smoothed = np.full((len(y), num_classes), epsilon / num_classes)
for i, label in enumerate(y):
smoothed[i, label] = 1 - epsilon + epsilon / num_classes
return smoothed
Mixup: Interpolate between examples
alpha = np.random.beta(0.2, 0.2)
x_mixed = alpha * x1 + (1 - alpha) * x2
y_mixed = alpha * y1 + (1 - alpha) * y2