MCPcopy Create free account
hub / github.com/alexrame/fishr / gaussian_kernel

Method gaussian_kernel

domainbed/algorithms.py:606–613  ·  view source on GitHub ↗
(self, x, y, gamma=[0.001, 0.01, 0.1, 1, 10, 100, 1000])

Source from the content-addressed store, hash-verified

604 return res.clamp_min_(1e-30)
605
606 def gaussian_kernel(self, x, y, gamma=[0.001, 0.01, 0.1, 1, 10, 100, 1000]):
607 D = self.my_cdist(x, y)
608 K = torch.zeros_like(D)
609
610 for g in gamma:
611 K.add_(torch.exp(D.mul(-g)))
612
613 return K
614
615 def mmd(self, x, y):
616 if self.kernel_type == "gaussian":

Callers 1

mmdMethod · 0.95

Calls 1

my_cdistMethod · 0.95

Tested by

no test coverage detected