All problems
MMD Domain Loss
Problem
Compute the biased maximum mean discrepancy with an RBF kernel.
K(a, b) = exp(-||a - b||^2 / (2 * bandwidth^2)); return mean K(s, s') + mean K(t, t') - 2 * mean K(s, t) rounded to 4 decimal places, averaging over all ordered pairs including self-pairs.
Test cases
case 1
in: [[[0,0],[1,0]],[[0,0],[1,0]],1]
expected: 0
case 2
in: [[[0,0]],[[1,0]],1]
expected: 0.7869
case 3
in: [[[0,0],[0,1]],[[1,1],[2,2]],2]
expected: 0.5484
Starter codePython
def mmd_rbf(source, target, bandwidth):
# Your code here
pass3 test cases · run your code against them in the editor