
Manhattan distance formula: |x1 - x2| + |y1 - y2|
Manhattan distance formula: |x1 - x2| + |y1 - y2|
Manhattan distance, also known as City block distance, measures the distance between two points in a grid-based path. It is calculated as the sum of the absolute differences of their Cartesian coordinates.
Example
If point A is at (3, 4) and point B is at (1, 1), the Manhattan distance is |3 - 1| + |4 - 1| = 2 + 3 = 5.
Understanding Manhattan distance is crucial in grid-based pathfinding algorithms, such as those used in urban planning and video game navigation.
Euclidean distance
Euclidean distance formula: √((x2 - x1)² + (y2 - y1)²)
Mahalanobis distance
Mahalanobis distance formula: D^2 = (x - μ)'Σ^(-1)(x - μ)
Minkowski spacetime
Minkowski distance formula: D = (Σ |x_i - y_i|^p)^(1/p)
Chebyshev distance
Chebyshev distance is named after Pafnuty Chebyshev
Cosine similarity
Cosine similarity formula: cos(θ) = (A · B) / (||A|| ||B||)
Write the triplet loss formula: max(d(a,p) - d(a,n) + margin, 0)
Triplet loss formula: max(d(a,p) - d(a,n) + margin, 0)
One email a day: 5 concepts + the 5 stories that matter →
Swipe through 100 ML concepts daily
Open TickerNews