(X, Y)
| 297 | |
| 298 | |
| 299 | def 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 | |
| 310 | def pairwise_l2_distances(X, Y): |