liveBook · Manning

Canberra distance

As explained in Outlier Detection in Python

Canberra distance is a normalized distance metric that sums coordinate-wise absolute differences divided by the corresponding absolute-value sums.

Canberra distance measures the difference between two numeric records by summing each feature’s absolute difference relative to the sum of the corresponding absolute values. This normalizes each coordinate’s contribution by the scale of the two values, producing a distance somewhat similar to Manhattan distance. section 9.7.1

Three-feature calculation

For [0.1, 0.6, 0.2] and [0.5, 0.4, 0.7], the distance is 0.4/0.6 + 0.2/1.0 + 0.5/0.9, or approximately 1.42. Each term compares a feature difference with the scale of the two values. section 9.7.1

Apply Canberra distance when:

  • Using distance or density-based outlier detectors such as KNN, KDE, or local outlier factor. section 9.7.1
  • Comparing it with Minkowski, Manhattan, Euclidean, or Chebyshev distances for a particular outlier-detection project. section 9.7.1 section 9.8

How Outlier Detection in Python covers it

How deep it goes
Defines the coordinate-wise formula and works through a three-feature calculation without developing a deeper derivation.
Examples
Uses two three-feature records, their coordinate differences, and a direct numerical distance calculation.
What it assumes
Assumes numeric features organized as comparable records.
What you can do after
Apply it via SciPy or supported scikit-learn and PyOD distance-based detectors.
How it connects
Connects Canberra distance with Manhattan distance, Minkowski distance, Chebyshev distance, KNN, KDE, and local outlier factor.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Outlier Detection in Python. The section links point to the parts of the book it draws on.