Recall & Review
beginner
What is a distance matrix in data science?
A distance matrix is a table that shows the distance between each pair of points in a dataset. It helps us understand how close or far points are from each other.
Click to reveal answer
beginner
Which function in scipy computes the distance matrix between points?
The function
scipy.spatial.distance_matrix computes the distance matrix between two sets of points.Click to reveal answer
beginner
How does the Euclidean distance between two points get calculated?
Euclidean distance is the straight-line distance between two points. It is calculated by taking the square root of the sum of squared differences of their coordinates.
Click to reveal answer
beginner
What is the shape of the distance matrix if you have 5 points?
The distance matrix will be a 5x5 square matrix, where each cell shows the distance between two points.
Click to reveal answer
intermediate
Why is computing a distance matrix useful in clustering?
It helps group points that are close together by showing how far apart each pair of points is. This is important for algorithms like k-means or hierarchical clustering.
Click to reveal answer
Which scipy function is used to compute the distance matrix?
✗ Incorrect
The function
scipy.spatial.distance_matrix computes distances between points.What does each element in a distance matrix represent?
✗ Incorrect
Each element shows the distance between a pair of points.
If you have 3 points, what will be the size of the distance matrix?
✗ Incorrect
The distance matrix is square with size equal to the number of points.
Which distance metric does scipy.spatial.distance_matrix use by default?
✗ Incorrect
It uses Euclidean distance by default.
Why might you want to compute a distance matrix before clustering?
✗ Incorrect
Distance matrices help identify groups of close points for clustering.
Explain what a distance matrix is and why it is useful in data science.
Think about how you measure distance between places on a map.
You got /3 concepts.
Describe how to compute a distance matrix using scipy and what the output looks like.
Imagine you have a list of points and want to know how far each is from the others.
You got /3 concepts.