MCPcopy Create free account
hub / github.com/ddbourgin/numpy-ml / kernel_checks

Function kernel_checks

numpy_ml/utils/kernels.py:299–307  ·  view source on GitHub ↗
(X, Y)

Source from the content-addressed store, hash-verified

297
298
299def kernel_checks(X, Y):
300 X = X.reshape(-1, 1) if X.ndim == 1 else X
301 Y = X if Y is None else Y
302 Y = Y.reshape(-1, 1) if Y.ndim == 1 else Y
303
304 assert X.ndim == 2, "X must have 2 dimensions, but got {}".format(X.ndim)
305 assert Y.ndim == 2, "Y must have 2 dimensions, but got {}".format(Y.ndim)
306 assert X.shape[1] == Y.shape[1], "X and Y must have the same number of columns"
307 return X, Y
308
309
310def pairwise_l2_distances(X, Y):

Callers 3

_kernelMethod · 0.85
_kernelMethod · 0.85
_kernelMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected