All problems
Mixup Loss on Mixed Probabilities
Problem
Compute mixup loss for a pair of samples: mix the probability vectors as lam*probs_a + (1-lam)*probs_b, then return lam*CE(y_a) + (1-lam)*CE(y_b) on the mixed distribution, clipping probabilities to at least 1e-15.
lam is the mixing weight in [0, 1].
Hint
Mix both the inputs (proxied by the probabilities) and the targets with the same lambda.
Test cases
case 1
in: [0,1,[0.8,0.2],[0.1,0.9],0.7]
expected: 0.6368223552427954
case 2
in: [0,1,[0.8,0.2],[0.1,0.9],1]
expected: 0.2231435513142097
case 3
in: [1,0,[0.3,0.7],[0.6,0.4],0.5]
expected: 0.6981723484866961
Starter codePython
import math
def mixup_loss(y_a, y_b, probs_a, probs_b, lam):
# Your code here
pass3 test cases · run your code against them in the editor