Distance and Similarity Measures

Different measures of distance or similarity are convenient for different types of analysis. The Wolfram Language provides built-in functions for many standard distance measures, as well as the capability to give a symbolic definition for an arbitrary measure.

ReferenceReference

Numerical Data

EuclideanDistance  ▪  SquaredEuclideanDistance  ▪  NormalizedSquaredEuclideanDistance  ▪  ManhattanDistance  ▪  ChessboardDistance  ▪  BrayCurtisDistance  ▪  CanberraDistance  ▪  CosineDistance  ▪  CorrelationDistance  ▪  BinaryDistance  ▪  WarpingDistance  ▪  CanonicalWarpingDistance

Boolean Data

HammingDistance  ▪  JaccardDissimilarity  ▪  MatchingDissimilarity  ▪  DiceDissimilarity  ▪  RogersTanimotoDissimilarity  ▪  RussellRaoDissimilarity  ▪  SokalSneathDissimilarity  ▪  YuleDissimilarity

String Data

EditDistance  ▪  DamerauLevenshteinDistance  ▪  HammingDistance  ▪  SmithWatermanSimilarity  ▪  NeedlemanWunschSimilarity

Images & Colors

ImageDistance  ▪  ColorDistance

Geospatial & Temporal Data

GeoDistance  ▪  TravelDistance  ▪  TravelTime  ▪  DateDifference

General & Mixed Data

FeatureDistance distance in a space of features trained from data

DistanceFunction option for specifying distance functions

DistanceMatrix matrix of pairwise distances between elements

Nearest  ▪  FindClusters  ▪  MeanShift  ▪  FindShortestTour  ▪  SequenceAlignment  ▪  DistanceTransform  ▪  GraphDistance

Visualization

Dendrogram  ▪  ClusteringTree