---
title: Data Trajectory Similarity Metric (DTSM)
url: https://www.emergentmind.com/topics/data-trajectory-similarity-metric-dtsm
type: topic
---

# Data Trajectory Similarity Metric (DTSM)

Searching arXiv for the cited works and recent usage of “Data Trajectory Similarity Metric (DTSM)”.
Data Trajectory Similarity Metric (DTSM) denotes, in the cited literature, a similarity or distance function defined on trajectories, subtrajectories, or sets of trajectories, with formulations ranging from hand-designed spatiotemporal scores to learned embedding-space distances. The term is used both as a general design lens—decomposing similarity into state, space, and time components—and as a concrete mechanism inside graph-based subtrajectory retrieval systems. Across the literature, DTSMs operate on symbolic cellular patterns, GPS point sequences, multivariate time series, road-network-constrained paths, and trajectory sets; they may return a normalized dissimilarity in \([0,1]\), a kernel-induced RKHS distance, a Euclidean distance between learned embeddings, or a max-over-subsegments similarity score [1206.1418] [2406.12913] [2507.05542] [2301.00393].

## 1. Conceptual scope and trajectory representations

A useful synthesis is that a DTSM is always tied to a representation choice. The survey literature organizes trajectory measures along three axes—**Non-learning vs. Learning**, **Free Space vs. Road Network**, and **Standalone vs. Distributed**—and uses this taxonomy to frame trajectory similarity as a core functionality for similarity search, clustering, anomaly detection, and representation learning [2303.05012]. This suggests that DTSM is not a single canonical formula, but a family of constructions whose semantics depend on what counts as a trajectory, how time is encoded, and whether similarity is measured directly or through an embedding.

| Regime | Trajectory/object form | Example source |
|---|---|---|
| Symbolic cellular mobility | \(P=\langle (c_1,t_1),\dots,(c_k,t_k)\rangle\) | [1206.1418] |
| GPS point sequence | \(T=\{X_1,\dots,X_n\},\ X_i=(\text{lon}_i,\text{lat}_i)\) | [2406.12913] |
| Multivariate time series | \(\mathbf{X}_t,\mathbf{Y}_t \in \mathbb{R}^n\) | [1906.09802] |
| Set of trajectories | \(A=\{A_i\}_{i=1}^{m_1}\) | [1601.03094] |
| Subtrajectory query object | \(T_{i:j}=(p_i,\dots,p_j)\) | [2507.05542] |

In symbolic cellular settings, space is not Euclidean but a set of cell identifiers, and time is a predefined timestamp scale; similarity is therefore driven by overlap of visited cells and timestamp agreement at common cells rather than by coordinate geometry [1206.1418]. In GPS settings, a trajectory is commonly a time-ordered sequence of sampled coordinates, later discretized into grid cells, POI cells, or graph nodes if a learning model requires tokenization or network structure [2406.12913]. In statistical formulations, a trajectory may be treated as a multivariate time series or even as a sample from an underlying distribution, which shifts the problem from point alignment to correlation structure or kernel mean embedding [1906.09802] [2301.00393].

A plausible implication is that any encyclopedic account of DTSM must distinguish at least five objects of comparison: whole trajectories, subtrajectories, trajectories constrained by a road graph, sets of trajectories with births and deaths, and trajectory embeddings learned from unlabeled or supervised data. The rest of the literature can be read as a sequence of increasingly specialized answers to that representational question.

## 2. Spatiotemporal factorization and alignment-based scoring

One of the clearest hand-designed DTSM templates is the weighted spatiotemporal measure for cellular mobility patterns. There, a mobility pattern is \(P=\langle (c_1,t_1),\dots,(c_k,t_k)\rangle\), the spatial component is a normalized count of uncommon cells,
\[
D_{\text{space}}(P_a,P_b)=\frac{f(P_a,P_b)}{n+m},
\]
and the temporal component averages normalized timestamp discrepancies over common cells,
\[
D_{\text{time}}(P_a,P_b)=\frac{1}{k}\sum_{c_{ai}=c_{bj}}\frac{|t_{ai}-t_{bj}|}{\max(t_{ai},t_{bj})}.
\]
The total dissimilarity is a convex combination
\[
D(P_a,P_b)=W_{\text{space}}D_{\text{space}}(P_a,P_b)+W_{\text{time}}D_{\text{time}}(P_a,P_b),
\]
with \(W_{\text{space}}+W_{\text{time}}=1\) [1206.1418]. This formulation is reflexive, symmetric, and bounded in \([0,1]\), but it is explicitly described as a symmetric dissimilarity rather than a strict metric because triangle inequality is not guaranteed.

A second classical construction approaches DTSM as an explicit monotone alignment problem between sampled trajectories. Given sampled trajectories \(P=\langle p_1,\dots,p_m\rangle\) and \(Q=\langle q_1,\dots,q_n\rangle\), an assignment
\[
\alpha:P\to Q\cup\{\bot\},\qquad \beta:Q\to P\cup\{\bot\}
\]
allows matched points and gaps, with monotonicity constraints preventing backtracking. The global similarity score is
\[
S(P,Q;E)=\sum_{(u,v)\in E}\frac{1}{c+\|u-v\|^2}+\sum_{g\in\mathcal{G}(E)}(a+\Delta|g|),
\]
where matched pairs are rewarded by inverse squared distance and gaps are penalized through a start penalty \(a\) and extension term \(\Delta\) [1303.05012]. This model is designed to align similar portions under different sampling rates, to introduce gaps for truly dissimilar regions or missing data, and to support both global similarity and local best-subtrajectory similarity. Its dynamic program runs in \(O(mn)\) time.

These two constructions expose a recurrent DTSM pattern. First, define what can match—same cell, nearby point, projected segment, or aligned event. Second, score positive evidence and negative evidence separately. Third, normalize or weight the result according to the application. This suggests why later DTSMs keep reappearing in “state component + time component”, “match reward + gap penalty”, or “local similarity + global pruning” form.

## 3. Geometric, statistical, and landmark-based formulations

A different line of work defines DTSM through invariance or geometry rather than explicit point alignment. The Generalized Multiple Correlation Coefficient (GMCC) treats a trajectory as a multivariate time series, \(\mathbf{X}_t,\mathbf{Y}_t\in\mathbb{R}^n\), and measures how well one trajectory can linearly predict the other. Its core similarity is
\[
\mathrm{GMCC}(\mathbf{X},\mathbf{Y})=R(\mathbf{X},\mathbf{Y})
=\sqrt{\sum_{i=1}^n R_{y_i}^2\frac{\sigma_{y_i}^2}{\sigma_Y^2}},
\]
and the symmetric distance used in experiments is
\[
d_{X,Y}=1-R_{\text{sym}}(\mathbf{X},\mathbf{Y}),\qquad
R_{\text{sym}}(\mathbf{X},\mathbf{Y})=\frac{R(\mathbf{X},\mathbf{Y})+R(\mathbf{Y},\mathbf{X})}{2}.
\]
GMCC is designed to be invariant to all nonsingular linear transformations—rotations, scalings, reflections, shear mappings, and squeeze mappings—while remaining selective against nonlinear relationships; it is robust to moderate noise, but it requires equal length and temporal alignment and does not handle time warping or shifting [1906.09802].

Landmark-based DTSMs take yet another route: map each trajectory to a Euclidean vector indexed by a fixed landmark set \(Q=\{q_1,\dots,q_n\}\). For a polygonal trajectory \(\gamma\), define
\[
v_i(\gamma)=\min_{p\in\gamma}\|q_i-p\|,
\qquad
p_i(\gamma)=\arg\min_{p\in\gamma}\|q_i-p\|.
\]
This yields two simple distances:
\[
d_Q(\gamma^{(1)},\gamma^{(2)})=
\left(\frac{1}{n}\sum_{i=1}^n (v_i^{(1)}-v_i^{(2)})^2\right)^{1/2},
\]
and
\[
d_Q^\pi(\gamma^{(1)},\gamma^{(2)})=
\frac{1}{n}\sum_{i=1}^n \|p_i^{(1)}-p_i^{(2)}\|.
\]
Weighted versions \(d_{Q,W}\) and \(d_{Q,W}^\pi\) make it possible to emphasize specific landmarks, such as a discriminative point of interest [1804.11284]. Under explicit geometric conditions—\(\tau\)-separated vertices inside a bounded region and a sufficiently dense grid of landmarks—both \(d_Q\) and \(d_Q^\pi\) are metrics on the corresponding family of curves.

A more statistical DTSM dispenses with point-to-point comparison altogether. In the distributional approach, a valid trajectory \(X=\ulcorner x_1,\dots,x_\mu\urcorner\) is regarded as an i.i.d. sample set from an underlying distribution \(\mathcal{P}_X\), and the empirical kernel mean embedding is
\[
\widehat{\mu}_{\mathcal{P}_X}=\Phi(\mathcal{P}_X)=\frac{1}{|X|}\sum_{x\in X}\phi(x).
\]
Trajectory similarity becomes the distributional kernel
\[
\mathcal{K}(\mathcal{P}_X,\mathcal{P}_Y)=\langle \Phi(\mathcal{P}_X),\Phi(\mathcal{P}_Y)\rangle,
\]
and the induced distance is \(\|\Phi(\mathcal{P}_X)-\Phi(\mathcal{P}_Y)\|\) [2301.00393]. With a characteristic kernel, the representation is injective at the distribution level, yielding the uniqueness property. The paper emphasizes two distinctive features: the method does not rely on point-to-point distances, and it requires no learning. With the Isolation Kernel, it also has a data-dependent property: two distributions are more similar to each other when measured in a sparse region than in a dense region.

Taken together, these constructions show that DTSM can encode three quite different inductive biases: linear-transform invariance, proximity to salient landmarks, or equality of underlying distributions. This suggests that “trajectory similarity” is often less about choosing a single distance formula than about choosing which invariances and which nuisance factors should be collapsed.

## 4. Learned embedding-based DTSMs

In the learning-based literature, DTSM usually means an encoder \(g\) or \(\mathcal{F}\) that maps each trajectory to a vector, after which similarity is computed by a simple vector-space distance. A general formulation is
\[
f(T_i,T_j)\approx d(g(T_i),g(T_j)),
\]
with the learned distance in embedding space acting as the trajectory similarity metric [2405.19761]. This shift is motivated by the high computational cost of conventional measures such as DTW, EDR, Hausdorff, and Fréchet, which are typically \(O(n^2)\) in trajectory length [2406.12913].

Several supervised DTSMs learn embeddings that approximate a chosen handcrafted measure. ConvTraj encodes raw GPS trajectories using a 1D convolution branch for sequential local patterns and a 2D convolution branch for geo-distribution, then uses Euclidean distance in the learned space as dissimilarity,
\[
d_{\text{ConvTraj}}(T_i,T_j)=\|g(T_i)-g(T_j)\|_2,
\]
with training driven by a triplet loss and an MSE term against a target measure such as DFD, DTW, Hausdorff, EDR, or EDwP [2405.19761]. ST2Vec performs an analogous role for road-network-constrained trajectories: it defines a target spatio-temporal distance
\[
\mathcal{D}(T_i,T_j)=\lambda\mathcal{D}_S(T_i^{(s)},T_j^{(s)})+(1-\lambda)\mathcal{D}_T(T_i^{(t)},T_j^{(t)}),
\]
learns spatial embeddings with Node2Vec plus GCN and temporal embeddings with Time2Vec-like encoding plus LSTM and attention, and uses Euclidean distance between final embeddings as a metric-like DTSM [2112.09339]. VeTraSS instead builds a multi-scale graph whose nodes are whole trajectories and whose edge weights derive from normalized Fréchet or Hausdorff distances; its GNN learns trajectory embeddings so that Euclidean distances reproduce the teacher geometry encoded in the trajectory graph [2404.08021].

More recent learned DTSMs focus on improving the learning signal itself. T-JEPA defines a self-supervised DTSM by learning a representation function \(\mathcal{F}(T)=E_\theta(\mathbf{g}_W(T))\) through Joint-Embedding Predictive Architecture; similarity is then computed as a distance between learned embeddings, without negative samples and without hand-crafted trajectory augmentations [2406.12913]. TSMini learns
\[
f'(T_i,T_j)=1-\text{dist}(g(T_i),g(T_j)),
\]
and combines a weighted MSE loss with a k nearest neighbor-guided LambdaLoss-style objective so that the model preserves not only absolute similarity values but also top-\(k\) neighborhood structure induced by the teacher measure [2502.00285].

A particularly important refinement concerns the geometry of the embedding space itself. The LH-plugin work argues that many widely used trajectory distances violate triangle inequality and that forcing them into Euclidean embeddings can distort similarity. It therefore introduces a Lorentz distance
\[
d_{Lo}(\mathbf{a},\mathbf{b})=|\langle \mathbf{a},\mathbf{b}\rangle|-\beta
\]
in hyperbolic space and a dynamic fusion distance
\[
d_{Fu}(T_a,T_b)=\alpha^{Lo}_{a,b}\,d_{Lo}(x_a^{\mathcal H},x_b^{\mathcal H})
+(1-\alpha^{Lo}_{a,b})\,d_{Eu}(x_a^{\mathcal E},x_b^{\mathcal E}),
\]
where \(\alpha^{Lo}_{a,b}\) is pair-dependent [2504.10933]. Here the deliberate absence of triangle inequality is not a defect but a design response to non-metric ground-truth trajectory relations.

## 5. Set-level and subtrajectory-centric DTSMs

Some DTSMs operate on objects larger or smaller than a single whole trajectory. For sets of trajectories, the key issue is identity continuity across time. One formulation extends two sets \(A=\{A_i\}_{i=1}^{m_1}\) and \(B=\{B_j\}_{i=1}^{m_2}\) with placeholder trajectories marked by \(*\), defines per-time cost matrices \(D^{AB}(t)\), and then solves a global optimization over time-varying soft associations \(W(t)\in\mathcal{P}\), the set of doubly stochastic matrices:
\[
\mathcal{D}_{comp}(A,B)=
\min_{W\in\mathcal{P}^T}
\left\{
\alpha\sum_{t=1}^{T-1}\|W(t+1)-W(t)\|
+\sum_{t=1}^{T}\mathrm{tr}(W(t)^\top D^{AB}(t))
\right\}.
\]
This “natural computable distance” is a true metric when the matrix norm is a switching norm and the base state distance is a metric; with the \(1\)-norm, it can be computed by linear programming in polynomial time [1601.03094]. It explicitly incorporates confusion of trajectories’ identity, different cardinalities, occlusions, births, and deaths.

At the opposite granularity, subtrajectory retrieval requires a similarity defined by the best local alignment between two trajectories. GTRSS introduces a concrete DTSM for that purpose. For two trajectories \(T_{d1}\) and \(T_{d2}\), the trajectory-level similarity is
\[
\Phi(T_{d1},T_{d2})=
\max \Theta_s(T_{d1}[i:k],T_{d2}[j:l])\ \big|\ (i,k,j,l)\in I,
\]
where \(\Theta_s\) is a dynamic-programming score over all subtrajectory pairs, and point pairs are marked similar or dissimilar through a binary matrix
\[
A_{i,j}=
\begin{cases}
1, & \text{if } d(p^1_i,p^2_j)\le \alpha,\\
-1, & \text{otherwise.}
\end{cases}
\]
The score is designed to favor subtrajectory pairs with many corresponding point pairs and few non-corresponding point pairs [2507.05542]. A key pruning theorem states that if the starting pair is dissimilar, then the similarity of any subtrajectory pair starting there cannot exceed the similarity of the pair starting one step later; this enables aggressive pruning during dynamic programming.

Inside GTRSS, DTSM is not the final user-facing query score. Instead, it is used offline to build a dual-layer graph index. In the upper layer, representative trajectories selected per spatial grid cell are connected by high, medium, and low DTSM similarity to balance local cohesion and global coverage. In the lower layer, each trajectory links to a mixture of spatially close high-DTSM neighbors and random neighbors. This suggests a distinctive role for DTSM: not only as a scoring function, but as an indexing signal that predicts which trajectories are likely to share high-quality representative subtrajectories under a later exact or approximate subtrajectory measure [2507.05542].

## 6. Recurrent properties, evaluation criteria, and limitations

A central theme across the literature is that “trajectory similarity” does not imply a single stance on metricity. Some DTSMs are explicit metrics under stated conditions, such as landmark distances on suitable curve families and the computable set-of-trajectories distance based on soft associations [1804.11284] [1601.03094]. Others are reflexive and symmetric but not guaranteed to satisfy triangle inequality, such as the weighted cellular dissimilarity and the temporal component based on common-cell timestamps [1206.1418]. GMCC is not symmetric in its base form and becomes a distance only after symmetrization [1906.09802]. Learned Lorentzian and fusion distances are intentionally non-metric because the teacher trajectory distances they seek to emulate often violate triangle inequality [2504.10933].

Evaluation criteria therefore vary with the formulation. Handcrafted measures are usually assessed by effectiveness, robustness, efficiency, and scalability; the survey literature explicitly proposes an evaluation benchmark with five real-world transformation scenarios to study these four dimensions across representative measures [2303.05012]. Learned DTSMs are typically judged by ranking fidelity—HR@k, R10@50, NDCG, mean rank—or by their ability to approximate teacher measures such as EDR, LCSS, Hausdorff, Fréchet, TP, DITA, LCRS, and NetERP [2406.12913] [2112.09339] [2405.19761] [2502.00285]. Subtrajectory-centric systems add retrieval accuracy and graph-navigation efficiency, while set-level metrics emphasize mathematically consistent handling of identity switches, false alarms, and missed tracks [1601.03094] [2507.05542].

The literature also converges on a stable list of limitations. Many classical measures are \(O(mn)\) and difficult to scale; this is the main reason for embedding-based DTSMs [2406.12913]. Symbolic or set-based formulations may ignore order or frequency; GMCC does not handle time warping; landmark methods depend on landmark placement; distributional kernels treat a trajectory as an i.i.d. sample set unless time is embedded as a feature; and learned embeddings may inherit the biases of their teacher measures or fail under strong domain shift [1206.1418] [1906.09802] [1804.11284] [2301.00393]. The recent hyperbolic work adds a further caution: insisting on Euclidean geometry can be structurally wrong when the underlying trajectory similarity relation is non-metric [2504.10933].

A plausible synthesis is that DTSM should be understood as a design space with three persistent trade-offs: exactness versus efficiency, metric consistency versus fidelity to non-metric trajectory relations, and hand-designed interpretability versus learned adaptability. The cited literature does not collapse these trade-offs into a single best formulation; instead, it provides a repertoire of mathematically distinct answers tailored to symbolic mobility, continuous free space, road networks, set-level tracking, and top-\(k\) subtrajectory retrieval.

Source: https://www.emergentmind.com/topics/data-trajectory-similarity-metric-dtsm