MCPcopy Create free account
hub / github.com/PythonOT/POT / kernel

Function kernel

ot/utils.py:42–49  ·  view source on GitHub ↗

r"""Compute kernel matrix

(x1, x2, method="gaussian", sigma=1, **kwargs)

Source from the content-addressed store, hash-verified

40
41
42def kernel(x1, x2, method="gaussian", sigma=1, **kwargs):
43 r"""Compute kernel matrix"""
44
45 nx = get_backend(x1, x2)
46
47 if method.lower() in ["gaussian", "gauss", "rbf"]:
48 K = nx.exp(-dist(x1, x2) / (2 * sigma**2))
49 return K
50
51
52def laplacian(x):

Callers 3

joint_OT_mapping_kernelFunction · 0.85
emd_laplaceFunction · 0.85
transformMethod · 0.85

Calls 3

get_backendFunction · 0.85
distFunction · 0.70
expMethod · 0.45

Tested by

no test coverage detected