import numpy as np
from sklearn.metrics import pairwise_distances
from scipy.spatial import distance_matrix
from scipy.spatial.distance import cdist
# 10-dimensional features
x = np.random.rand(400000).reshape((-1, 10))
y = np.random.rand(45000).reshape((-1, 10))
def option1():
dists = pairwise_distances(x, y)
def option2():
dists = distance_matrix(x, y)
def option3():
dists = cdist(x, y)