Bird
0
0

Which of the following best describes the output of scipy.spatial.distance_matrix(X, Y) when X and Y are two arrays of points?

easy📝 Conceptual Q1 of 15
SciPy - Clustering and Distance
Which of the following best describes the output of scipy.spatial.distance_matrix(X, Y) when X and Y are two arrays of points?
AA matrix where each element is the Euclidean distance between a point in <code>X</code> and a point in <code>Y</code>
BA matrix of dot products between points in <code>X</code> and <code>Y</code>
CA list of indices representing the nearest neighbors of points in <code>X</code> within <code>Y</code>
DA boolean matrix indicating if points in <code>X</code> and <code>Y</code> are identical
Step-by-Step Solution
Solution:
  1. Step 1: Understand the function

    scipy.spatial.distance_matrix computes pairwise distances between two collections of points.
  2. Step 2: Identify the metric used

    By default, it calculates the Euclidean distance between each pair of points.
  3. Final Answer:

    A matrix where each element is the Euclidean distance between a point in X and a point in Y -> Option A
  4. Quick Check:

    Distance matrix output matches pairwise Euclidean distances [OK]
Quick Trick: Distance matrix returns pairwise Euclidean distances [OK]
Common Mistakes:
  • Confusing distance matrix with dot product matrix
  • Expecting indices instead of distances
  • Assuming output is boolean or categorical

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SciPy Quizzes