Pairwise Euclidean Distances
easynumpy_basicsImplement pairwise_distances(x, y).
Given x of shape (n, d) and y of shape (m, d), return an array D
of shape (n, m) where D[i, j] is the Euclidean distance between x[i]
and y[j].
The whole point of this task is to practice broadcasting, so you must vectorize it.
Constraints
- no scipy, sklearn
- no for/while loops
Your solution
Edit pairwise_distances and run the real pytest suite in your browser — no install required. Your code is saved locally.
Loading the Python runtime (first run only)…
Hints
Hint 1
Think about 2D shape of the final result and how to get it from two input vectors (1D array).