Graph
Manhattan Distance

📏Manhattan Distance

NEW

Also known as: L1 Distance, Taxicab Distance

A metric equal to the sum of absolute differences of coordinates between two points in a grid-like space.

DESCRIPTION

Manhattan distance computes the L1 norm between points, summing absolute coordinate differences. It suits high-dimensional sparse data and grid-based movement. In machine learning, it influences clustering, nearest neighbors, and regularization (L1). Compared to Euclidean, it can be more robust to outliers and better reflect city-block constraints.

ALTERNATIVE DEFINITIONS

Wolfram MathWorld

The taxicab metric is the L1 metric defined by d(x,y) = sum_i |x_i − y_i|.

Provides a concise formula defining the L1 metric.

Source

Encyclopedia of Mathematics

The L1 metric on R^n is defined by ρ(x,y) = Σ |x_i − y_i|, i = 1,…,n.

Formal definition in metric space terms.

Source

scikit-learn

Supported metrics include ‘manhattan’, which computes the sum of absolute value differences across dimensions.

Practical implementation note within ML toolkit.

Source

Lp Norm K-Nearest Neighbors L1 Regularization Feature Scaling Cluster Analysis Similarity Search

COMPETING TERMS

Euclidean Distance Chebyshev Distance Minkowski Distance

KNOWLEDGE AREAS

Mathematics Data Science AI

TARGET AUDIENCE

Data Scientist AI Engineer Data Analyst

EXTERNAL SOURCES

TOP QUESTIONS

When is Manhattan Distance preferred over Euclidean Distance?

In high-dimensional sparse spaces or grid-based movement, Manhattan distance can better reflect path costs and reduce sensitivity to large coordinate differences.

Category: Requirements

How does Manhattan Distance relate to L1 regularization?

Both use the L1 norm. L1 regularization encourages sparsity in parameters, analogous to summing absolute differences in distance.

Category: Example

What is a common mistake using Manhattan Distance in ML?

Failing to scale features. Different scales distort distance computations; standardize or normalize inputs to ensure meaningful comparisons.

Category: Mistakes

What is the risk of relying solely on Manhattan Distance?

It may misrepresent relationships in low dimensions where Euclidean geometry is more appropriate. Always validate distance choice against task performance.

Category: Risks

How is Manhattan Distance used in clustering?

It defines proximity between data points. Algorithms like k-medians leverage L1 distance to find representative centers robust to outliers.

Category: Example

Is Manhattan Distance metric a special case of Minkowski?

Yes. Manhattan distance is the Minkowski metric with p=1, while Euclidean is p=2.

Category: Example

How does Manhattan Distance impact k-NN classification?

It changes neighborhood shapes and sensitivity. For certain data distributions, L1 can improve performance compared to L2.

Category: Opinion

What is a hot topic around Manhattan Distance?

Efficient nearest neighbor search in high dimensions using L1-friendly indexes and embeddings.

Category: Topic

How to compute Manhattan Distance efficiently?

Vectorize absolute differences and sum across dimensions. Use optimized libraries and avoid Python loops for speed.

Category: Management