1Problem and significance
A GPS trajectory is a sequence of \(N\) timestamped locations. Staypoint detection labels every point as stop or move:
Here \(\ell_i\) are coordinates and \(t_i\) timestamps. A maximal contiguous span labeled stop defines a dwell episode \(s\). The target therefore has two parts: point-level movement evidence and the temporal coherence of the resulting span.
- Staypoints are the unit that mobility analysis consumes. Home/work inference, next-location prediction, anomaly detection, activity recognition, and duration forecasting all operate on staypoint-level histories, their semantic labels, and their dwell times.
- Detection requires motion and place jointly. Low speed may indicate an activity, congestion, a traffic signal, or positioning noise. Separating these cases requires spatial concentration, temporal persistence, arrival and departure transitions, and whether the surrounding geography supports a stay.
- Cities differ. Sampling rates, mobility patterns, and available geographic context change across regions, so a representation learned in one city must transfer and must remain usable when some context source is missing.
The goal is to use staypoint detection as a pretext task: learn an encoder on a labeled source city that produces a fused state \(\mathbf{h}_i\) per point, a coherent stop/move decoding, and a staypoint representation \(\mathbf{z}_s\),
such that the frozen \(\mathbf{z}_s\), read by lightweight task-specific heads, supports diverse downstream tasks in the source city and in other cities.
2Research questions
Equation (2) makes three claims that must be tested separately: the pretext must be learnable as coherent spans; the pooled representation must be reusable without per-task backbone training; and it must survive a change of city, with or without unlabeled target data. A fourth question asks which geographic sources the transfer depends on.
| RQ | Question | Addressed by | Evidence |
|---|---|---|---|
| RQ1 | Can stop/move spans be detected accurately from fused motion and place evidence under a structured objective? | Motion–place encoder, CRF decoding, dwell-structured objective (§3.1–3.5) | Table 3 |
| RQ2 | Does one frozen staypoint representation support semantic, anomaly, duration, and sequential tasks in the source city? | Marginal-weighted staypoint pooling (§3.4) | Table 4 |
| RQ3 | Does the representation transfer to other cities and datasets without target labels, and does unlabeled target adaptation add to it? | City-agnostic place interface (§3.2); Geo-TTST (§3.6) | Tables 5–8 |
| RQ4 | Which geographic sources (POIs, regional semantics, mobility graph, continuous coordinates) does the representation depend on? | Place view components (§3.2) | Tables 9–10 |
3Method
StayBERT has five components: a motion view producing \(\mathbf{m}_i\in\mathbb{R}^{256}\); a place view producing a query-conditioned geographic state \(\mathbf{g}_i\in\mathbb{R}^{128}\); a dimension-wise gate that fuses them into \(\mathbf{h}_i\in\mathbb{R}^{128}\); a linear-chain CRF with marginal-weighted staypoint pooling; and a dwell-structured pretraining objective. Geo-Conditional Test-Time Self-Training (Geo-TTST) is an optional target-city adaptation step that updates only the CRF head. Algorithm 1 gives pretraining and downstream use; Algorithm 2 gives Geo-TTST.
Input: labeled source trajectories \(\mathcal{D}=\{(\mathcal{T}^{(k)},\mathbf{y}^{(k)})\}\); GeoContext sources on a spatial grid; weights \(\lambda_{\mathrm{rec}},\lambda_{\mathrm{bnd}},\lambda_{\mathrm{seg}},\beta,w_{\mathrm{move}}\). Output: encoder parameters \(\theta\); staypoint representations \(\mathbf{z}_s\).
- Offline: build POI sets, spatial and flow grid graphs, and regional semantic vectors on a common grid ▷ §3.2; no downstream labels used
- for epoch \(e=1,\dots,E\) (early stopping):
- for each mini-batch of windows \((\mathcal{T},\mathbf{y})\):
- \(\widetilde{\mathcal{T}}\leftarrow\mathcal{A}_{\mathrm{ATR}}(\mathcal{T};\rho)\), \(\rho\in[\rho_{\min},1]\) ▷ Eq. (12); all terms below use \(\widetilde{\mathcal{T}}\)
- \(\mathbf{m}_i\leftarrow\) Transformer over TCN-smoothed and raw coordinates, \(\Delta t_i\), log-speed ▷ §3.1
- \(\mathbf{q}_i\leftarrow\Phi_{\mathrm{loc}}(\ell_i)\); \(\mathbf{g}_i\leftarrow\) query-conditioned composition, scaled by \(\alpha_e\) ▷ Eqs. (3)–(4), (18)
- \(\mathbf{h}_i\leftarrow\boldsymbol{\alpha}_i\odot\tilde{\mathbf{m}}_i+(1-\boldsymbol{\alpha}_i)\odot\tilde{\mathbf{g}}_i\) ▷ Eqs. (5)–(6)
- compute CRF emissions, marginals, and \(\mathcal{L}_{\mathrm{dwell}}\); AdamW step on \(\theta\) ▷ Eqs. (7)–(8), (10)–(17)
- Freeze \(\theta\). For each staypoint interval \(s\) (given, or a Viterbi-decoded stop span): \(\mathbf{z}_s\leftarrow\sum_{i\in s}w_i\mathbf{h}_i\) ▷ Eq. (9)
- Train a task-specific head on \(\mathbf{z}_s\) (optionally concatenated with normalized coordinate and temporal features) ▷ §4
- Optional, in a target city with unlabeled trajectories: run Geo-TTST ▷ Algorithm 2
3.1Motion view
The motion view encodes how the user is moving. A temporal convolutional front-end (four blocks) produces a smoothed coordinate estimate from the input trace. For point \(i\), the motion token combines this estimate with the original coordinates, the elapsed time \(\Delta t_i\), and the log-speed. A two-layer Transformer (\(d_{\mathrm{model}}=256\), eight heads) contextualizes the tokens and outputs \(\mathbf{m}_i\in\mathbb{R}^{256}\). The stream is trained jointly with the pretext and captures velocity changes, temporal persistence, and approach and departure patterns around dwell boundaries.
3.2Place view and query-conditioned composition
The place view builds a point representation from four sources of geographic evidence, assembled offline on a common grid and queried at each point.
- Geodesic anchor. Sphere2Vec maps longitude and latitude to spherical basis functions at 16 geometrically spaced frequencies; the 48-dimensional basis is projected to a 64-dimensional query \(\mathbf{q}_i=\Phi_{\mathrm{loc}}(\ell_i)\).
- Functional neighborhood. A KD-tree retrieves up to \(K=20\) POIs within 0.005° of the grid center, in six categories (residential, workplace, restaurant, recreation, education, religion). Each POI token adds a learned type embedding to a multi-scale encoding of its displacement from \(\ell_i\); four-head attention from \(\mathbf{q}_i\) summarizes the set into \(\mathbf{c}^{\mathrm{poi}}_i\in\mathbb{R}^{64}\).
- Mobility structure. On a 0.005° grid, a spatial graph (eight-neighbor adjacency plus five-nearest-neighbor links in grid-feature space) and a directed flow graph (consecutive transitions observed at least ten times, weights \(\log(1+\text{count})\)) are encoded by separate two-layer GraphSAGE branches, concatenated, and projected to \(\mathbf{c}^{\mathrm{net}}_i\in\mathbb{R}^{64}\). Both graphs are built per city; this is the only city-specific source.
- Regional semantics. A text description of each cell (coordinates, nearby POI counts, dominant land use) is embedded by a frozen Sentence-BERT encoder (all-MiniLM-L6-v2) and reduced to 64 dimensions by PCA, giving \(\mathbf{c}^{\mathrm{sem}}_i\).
The available tokens form a context bank, and the Sphere2Vec query attends over it:
where \(\mathrm{MHA}\) is four-head attention with query \(\mathbf{q}_i\), \(\mathrm{LN}\) is layer normalization, and \(W_o\) projects to the 128-dimensional place state. A missing source is removed from \(C_i\) rather than replaced by a placeholder; with no external source, \(\mathbf{g}_i\) reduces to the projected Sphere2Vec query. Three of the four sources (Sphere2Vec, POIs, regional semantics) have a common cross-city interface, which is what permits direct transfer (§3.6).
3.3Motion–place gate
The two states differ in dimension and statistics. They are projected into a shared 128-dimensional space and combined by a point-wise, dimension-wise gate:
with \(\mathbf{h}_i,\boldsymbol{\alpha}_i\in\mathbb{R}^{128}\), \(\sigma\) the logistic function, and \(\odot\) the element-wise product. Because \(\boldsymbol{\alpha}_i\) is a vector, some dimensions can follow sharp motion changes while others retain stable functional context. The mean of \(1-\boldsymbol{\alpha}_i\) is reused in §3.6 as a measure of reliance on the place stream.
3.4CRF decoding and staypoint pooling (RQ1, RQ2)
A linear-chain CRF scores a label sequence \(\mathbf{y}\) for trajectory \(\mathcal{T}\) with fused states \(\{\mathbf{h}_i\}_{i=1}^N\):
where \(e_\theta(\mathbf{h}_i)\) is the stop/move emission vector and \(A\) the learned transition matrix. The conditional likelihood and per-trajectory negative log-likelihood are
Viterbi decoding turns local evidence into coherent dwell intervals. For an interval \(s\), let \(p_i\) be the CRF marginal probability of stop at point \(i\). The staypoint representation is the marginal-weighted mean of the point states:
The interval \(s\) is either supplied during representation evaluation or taken from a CRF-decoded stop span. \(\mathbf{z}_s\) is the representation consumed by all downstream heads.
3.5Dwell-structured pretraining objective (RQ1)
Sequence level. Long stop interiors would dominate an unweighted CRF loss. The primary term normalizes by valid length and up-weights trajectories that contain move points:
where \(N_k\) is the valid length of trajectory \(k\), \(r_k\) its move-point fraction, and \(w_{\mathrm{move}}=20\).
Observation level. Adaptive trajectory resampling (ATR) keeps an order-preserving random fraction \(\rho\) of observations and recomputes elapsed-time features:
ATR is an augmentation, not a loss: the same ten-minute dwell may be seen every 10 or every 30 seconds, which discourages dependence on one sampling rate. All terms of the full objective are evaluated on \(\widetilde{\mathcal{T}}\):
Point level. For the set \(\mathcal{M}\) of masked valid positions, a decoder \(d_\psi\) reconstructs the normalized coordinates \(\bar{\ell}_i\):
Transition level. For the sparse set \(\mathcal{B}=\{i:y_i\neq y_{i-1}\}\) of labeled arrival and departure points,
Segment level. For each ground-truth dwell span \(s\in\mathcal{S}\), let \(p_i=P_\theta(y_i=\text{stop}\mid\mathcal{T})\) and let \(\widehat{\ell}_i\) be the predicted coordinate. The probability-weighted and geometric centroids are
and the segment term aligns them while penalizing the mean stop probability \(\bar{p}_{\partial s}\) in the region just outside the span:
The four terms model sequence coherence, point-level geometry, motion transitions, and complete dwell structure, respectively.
GeoContext warmup. To keep uncalibrated place features from dominating early training, the place state is scaled at epoch \(e\) by
This is an optimization schedule, not part of the representation.
3.6Cross-city adaptation: Geo-TTST (RQ3)
Direct transfer. The source-pretrained model is applied to a target city with no target labels. The mobility-graph token is omitted when no compatible target graph exists, and any other missing source is removed from \(C_i\) in Eq. (3).
Geo-conditioned confidence. When unlabeled target windows \(\mathcal{D}_t=\{\mathcal{T}_j\}\) are available, Geo-TTST self-trains on confident pseudo-labels. Predictive confidence alone can be unreliable under geographic shift, so it is combined with the place-reliance signal from the gate. In round \(r\), with CRF marginal \(p^{(r)}_{j,i}(y)\) and gate \(\boldsymbol{\alpha}^{(r)}_{j,i}\),
where \(\gamma\in[0,1]\) balances predictive certainty against geographic support. With \(v_{j,i}\in\{0,1\}\) marking valid, non-padded points, the selected set is
Restricted update. The motion encoder, GeoContext encoder, and fusion module are frozen; only the CRF parameters \(\theta_{\mathrm{CRF}}\) are updated. Because confidence filtering can keep non-contiguous points, the loss uses the differentiable CRF marginals at the selected points instead of a full-sequence likelihood:
Updating only the CRF head recalibrates stop/move decoding without overwriting \(\mathbf{h}_i\). Target stop/move labels are never passed to the model and are used only for offline evaluation.
Input: source-pretrained \(\theta=(\theta_{\mathrm{enc}},\theta_{\mathrm{fuse}},\theta_{\mathrm{CRF}})\); unlabeled target windows \(\mathcal{D}_t\); rounds \(T\), update epochs \(K\), threshold \(\tau\), weight \(\gamma\), learning rate \(\eta\). Output: adapted \(\theta_{\mathrm{CRF}}\).
- Omit geographic sources unavailable in the target domain; freeze \(\theta_{\mathrm{enc}}\) and \(\theta_{\mathrm{fuse}}\)
- for \(r=1,\dots,T\):
- evaluation mode: for each target mini-batch, compute marginals \(p^{(r)}\), gates \(\boldsymbol{\alpha}^{(r)}\), and valid mask \(v\) ▷ Eq. (8)
- set \(\hat{y}^{(r)}_{j,i}\) and \(c^{(r)}_{j,i}\); \(\hat{m}^{(r)}_{j,i}\leftarrow\mathbf{1}[c^{(r)}_{j,i}>\tau]\,v_{j,i}\) ▷ Eqs. (19)–(21)
- training mode: for \(k=1,\dots,K\), for each shuffled target mini-batch:
- recompute CRF marginals with the current \(\theta_{\mathrm{CRF}}\); skip the batch if it has no selected points
- compute \(\mathcal{L}^{(r)}_{\mathrm{TTST}}\); update only \(\theta_{\mathrm{CRF}}\) with AdamW ▷ Eq. (22); pseudo-labels fixed within the round
- return \(\theta_{\mathrm{CRF}}\)
The reported Atlanta configuration uses \(T=3\) rounds, \(K=1\) update epoch per round, \(\tau=0.95\), \(\gamma=0.5\), learning rate \(5\times10^{-5}\), batch size 32, AdamW weight decay \(10^{-4}\), and gradient-norm clipping at 1.0, with the city-specific road graph disabled.
4Experimental protocol
| Setting | Data | Tasks and metrics | Compared against |
|---|---|---|---|
| Pretraining and pretext check | SF-LIFE: 1,000 agents from the public 500K-agent, 70-day corpus, resampled from 5 s to 10 s; 512-point windows, stride 256 | Point macro F1 (stop/move); segment precision/recall/F1 with 0.001° (∼111 m) and 5 min tolerances | Ground-truth stop/move labels |
| In-domain | SF-LIFE | Home/Work (three-class macro F1), Activity (six-class macro F1), Anomaly (AUROC), Duration (MAE, min), NextActivity (macro F1), NextLocation (Top-1, Top-5, Acc@500 m, Acc@1 km); Trajectory User Linking (Top-1, Top-5) as a diagnostic | Task-specific baselines (MLPs on conventional features; Markov or frequency models); TS2Vec, TrajCL, START, MTM with the same probes |
| Cross-region transfer | Atlanta: 500 agents, 30 days, ∼22M GPS points | Same tasks and metrics as in-domain; NextLocation with a hybrid head (transition, frequency, recency, distance priors) | Feature-only and task-specific baselines; public methods transferred from SF-LIFE and trained on Atlanta; Atlanta-trained StayBERT |
| Cross-dataset transfer | GeoLife: 177 users, 19,372 derived staypoints | Home/Work, Activity, NextActivity, Anomaly, Duration (NextLocation excluded: candidate identities are dataset-specific) | GeoLife feature-only; TS2Vec, TrajCL, START, MTM |
The encoder is frozen for all downstream tasks; Atlanta and GeoLife labels train only the heads and are mapped to the six-class SF-LIFE venue schema. For the four tabular tasks and NextActivity, a “+ raw” variant concatenates normalized coordinate and temporal features with the embeddings; this is not used for NextLocation. Pretraining uses AdamW, batch 128, at most 30 epochs with patience 5, learning rate \(2\times10^{-3}\) (\(2\times10^{-4}\) for GeoContext), weight decay \(10^{-4}\), a three-epoch learning-rate warmup, and the 20-epoch GeoContext warmup of Eq. (18).
5Results
5.1Pretext learning (RQ1)
| Metric | Value |
|---|---|
| Validation point macro F1 | 0.9924 |
| Test point macro F1 | 0.9929 |
| Test segment precision / recall / F1 | 0.9993 / 0.9986 / 0.9990 |
| Detected / ground-truth segments | 25,864 / 25,880 |
Finding. The pretext is learned almost exactly: test point macro F1 is 0.9929 and segment F1 is 0.9990, with 25,864 segments detected against 25,880 in the ground truth. In a controlled diagnostic, removing the GeoContext warmup of Eq. (18) lowers validation F1 from 0.9836 to 0.4966 and segment F1 from 0.5538 to 0.0095. These numbers verify the pretext only; the evidence for the representation is the downstream transfer below.
5.2In-domain multi-task evaluation (RQ2)
| Method | HW↑ | Act.↑ | NAct.↑ | Anom.↑ | Dur.↓ | NL@1↑ | NL@5↑ | NL@500m↑ | NL@1km↑ |
|---|---|---|---|---|---|---|---|---|---|
| Task-specific baseline | 0.6765 | 0.5916 | 0.1693 | 0.7269 | 262.7 | 0.4866 | 0.7240 | 0.5028 | 0.5409 |
| TS2Vec | 0.6402 | 0.5778 | 0.2340 | 0.7156 | 109.2 | 0.3800 | 0.7063 | 0.4023 | 0.4600 |
| TrajCL | 0.6394 | 0.5797 | 0.2657 | 0.7144 | 94.3 | 0.3864 | 0.7212 | 0.4122 | 0.4723 |
| START | 0.6929 | 0.5964 | 0.3028 | 0.7230 | 64.8 | 0.4260 | 0.7221 | 0.4768 | 0.5335 |
| MTM | 0.7193 | 0.6210 | 0.3152 | 0.7195 | 154.3 | 0.2486 | 0.4520 | 0.2991 | 0.3941 |
| StayBERT (frozen) | 0.7106 | 0.6036 | 0.3156 | 0.7603 | 69.6 | 0.4548 | 0.7360 | 0.4423 | 0.4867 |
| StayBERT + raw | 0.7280 | 0.5966 | 0.3098 | 0.7408 | 86.5 | – | – | – | – |
Finding. StayBERT is first or second on seven of nine metrics. The frozen representation is best on NextActivity (0.3156), Anomaly (0.7603 against 0.7269 for the task baseline), and NextLocation Top-5 (0.7360); adding raw features gives the best Home/Work F1 (0.7280) but lowers NextActivity to 0.3098. It is not best on Activity (MTM, 0.6210 against 0.6036), Duration (START, 64.8 against 69.6 min), or NextLocation Top-1, 500 m, and 1 km, where the task-specific baseline leads (for example 0.4866 against 0.4548 Top-1).
5.3Cross-city and cross-dataset transfer (RQ3)
Three StayBERT configurations are evaluated on Atlanta: direct transfer of the SF-LIFE encoder with no parameter updates and the road graph disabled; direct transfer followed by Geo-TTST (Algorithm 2); and an Atlanta-trained reference with the same architecture and hyperparameters.
| Setting | HW↑ | Act.↑ | Anom.↑ | Dur.↓ |
|---|---|---|---|---|
| Atlanta baseline | ||||
| Feature-only | 0.6400 | 0.9259 | 0.8352 | 163.6 |
| Public methods, SF-LIFE → Atlanta | ||||
| TS2Vec | 0.5153 | 0.6712 | 0.8855 | 186.9 |
| TrajCL | 0.5079 | 0.5888 | 0.8911 | 211.3 |
| START | 0.5454 | 0.6620 | 0.9034 | 95.0 |
| MTM | 0.5209 | 0.5806 | 0.9050 | 204.5 |
| Public methods, Atlanta-trained | ||||
| TS2Vec | 0.5226 | 0.6427 | 0.8909 | 179.2 |
| TrajCL | 0.5308 | 0.6251 | 0.8843 | 202.1 |
| START | 0.6026 | 0.7079 | 0.8957 | 102.1 |
| MTM | 0.5230 | 0.5926 | 0.9024 | 83.7 |
| StayBERT | ||||
| Direct transfer | 0.7256 | 0.8980 | 0.9059 | 80.8 |
| Direct + Geo-TTST | 0.7028 | 0.9030 | 0.9166 | 79.4 |
| Direct + raw | 0.7481 | 0.8813 | 0.9430 | 76.4 |
| Atlanta-trained | 0.7311 | 0.8998 | 0.9038 | 94.0 |
| Atlanta-trained + raw | 0.8046 | 0.9579 | 0.9400 | 82.0 |
Finding. Direct transfer is the strongest source-pretrained model on all four probes (HW 0.7256 against 0.5454 for START; Duration 80.8 against 95.0 min). It nearly matches Atlanta-trained StayBERT on Home/Work (0.7256 against 0.7311) and Activity (0.8980 against 0.8998) and is better on Anomaly and Duration (80.8 against 94.0 min). Adding raw features gives the best Anomaly (0.9430) and Duration (76.4) but lowers Activity to 0.8813. Geo-TTST changes are small and mixed (Home/Work −0.0228, Anomaly +0.0107). The best Home/Work and Activity scores come from the Atlanta-trained model with raw features, and the Atlanta feature-only baseline (0.9259) exceeds direct transfer on Activity.
| Setting | NAct↑ | NL@1↑ | NL@5↑ | NL@500m↑ | NL@1km↑ |
|---|---|---|---|---|---|
| Task-specific baselines | |||||
| NAct majority | 0.2514 | n/a | n/a | n/a | n/a |
| NAct Markov | 0.2514 | n/a | n/a | n/a | n/a |
| NL frequency | n/a | 0.3636 | 0.9099 | 0.4076 | 0.5290 |
| NL Markov | n/a | 0.5725 | 0.9206 | 0.6050 | 0.6662 |
| Public methods, SF-LIFE → Atlanta | |||||
| TS2Vec | 0.5432 | 0.5802 | 0.9602 | 0.6255 | 0.7124 |
| TrajCL | 0.4878 | 0.5935 | 0.9678 | 0.6275 | 0.7207 |
| START | 0.6032 | 0.7597 | 0.9704 | 0.7810 | 0.8371 |
| MTM | 0.5169 | 0.3326 | 0.9542 | 0.4185 | 0.5370 |
| Public methods, Atlanta-trained | |||||
| TS2Vec | 0.4966 | 0.5664 | 0.9381 | 0.5974 | 0.6792 |
| TrajCL | 0.5002 | 0.5568 | 0.9533 | 0.6105 | 0.6858 |
| START | 0.5830 | 0.6583 | 0.9139 | 0.6862 | 0.8333 |
| MTM | 0.6438 | 0.3034 | 0.9208 | 0.3920 | 0.5164 |
| StayBERT | |||||
| Direct transfer | 0.6847 | 0.6822 | 0.9587 | 0.7099 | 0.7591 |
| Direct + Geo-TTST | 0.7109 | 0.7544 | 0.9802 | 0.7862 | 0.8032 |
| Atlanta-trained | 0.6599 | 0.6799 | 0.9598 | 0.7107 | 0.7606 |
Finding. Direct transfer reaches 0.6847 NextActivity F1, against 0.2514 for the task-specific baselines and 0.6599 for Atlanta-trained StayBERT; Geo-TTST raises it to 0.7109, the best result. For NextLocation, Geo-TTST is best on Top-5 (0.9802) and 500 m accuracy (0.7862) and close to START on Top-1 (0.7544 against 0.7597), while transferred START keeps the best 1 km accuracy (0.8371 against 0.8032). On sequential tasks Geo-TTST gives consistent gains over direct transfer, unlike on the tabular probes.
| Configuration | Top-1↑ | Top-5↑ | Users | Sequences |
|---|---|---|---|---|
| SF-LIFE frozen | 0.1 | 0.6 | 903 | 2270 |
| SF-LIFE → Atlanta | 0.2 | 1.0 | 500 | 500 |
| Atlanta-trained reference | 85.4 | 94.8 | 500 | 500 |
Finding. User identity is not recoverable from the transferred representation: frozen SF-LIFE embeddings stay at chance level (0.1% Top-1 for 903 users; 0.2% after transfer to 500 Atlanta users), while the Atlanta-trained reference reaches 85.4% Top-1. User linking depends on target-specific spatial signatures and repeated routines, which marks a boundary of cross-region transfer.
| Method | HW↑ | Act.↑ | NAct↑ | Anom.↑ | Dur.↓ |
|---|---|---|---|---|---|
| GeoLife feature-only | 0.2610 | 0.2142 | 0.2703 | 0.8002 | 65.1 |
| TS2Vec | 0.3378 | 0.2344 | 0.1674 | 0.6716 | 59.3 |
| TrajCL | 0.3340 | 0.2176 | 0.2531 | 0.6857 | 58.6 |
| START | 0.3202 | 0.2298 | 0.2352 | 0.6729 | 58.3 |
| MTM | 0.3401 | 0.2250 | 0.1674 | 0.6762 | 59.0 |
| StayBERT | 0.3417 | 0.2488 | 0.2705 | 0.7739 | 58.4 |
| StayBERT + raw | 0.3346 | 0.2473 | – | 0.7768 | 58.3 |
Finding. Frozen StayBERT is best on Home/Work, Activity, and NextActivity, with the largest gain on Home/Work over the feature-only baseline (0.3417 against 0.2610); the margins over the strongest public method are small (0.3417 against 0.3401 for MTM) and NextActivity is effectively tied with feature-only (0.2705 against 0.2703). Anomaly detection is dominated by target-domain statistics: the feature-only baseline leads (0.8002 against 0.7768 with raw features). StayBERT with raw features ties START on Duration (58.3 min). Raw features change the transferred scores only marginally, so the gains come from the frozen representation.
5.4GeoContext ablations (RQ4)
| Metric | Full | −POI | −LLM | −Road GNN | Grid coords |
|---|---|---|---|---|---|
| Semantic | |||||
| HW (F1) ↑ | 0.7256 | 0.7103 | 0.5719 | 0.6229 | 0.5514 |
| Activity (F1) ↑ | 0.8980 | 0.8664 | 0.6854 | 0.7960 | 0.5950 |
| Behavioral / temporal | |||||
| NAct (F1) ↑ | 0.6847 | 0.6635 | 0.5347 | 0.7260 | 0.5747 |
| Anomaly (AUROC) ↑ | 0.9059 | 0.9012 | 0.9076 | 0.9069 | 0.9047 |
| Duration (MAE) ↓ | 80.8 | 166.7 | 100.8 | 70.6 | 90.7 |
| Embedding-only NextLocation | |||||
| NL@1 ↑ | 0.6109 | 0.2924 | 0.5033 | 0.5359 | 0.6000 |
| NL@5 ↑ | 0.9382 | 0.8970 | 0.9586 | 0.9292 | 0.9440 |
| NL@500m ↑ | 0.5886 | 0.3255 | 0.5529 | 0.5657 | 0.6293 |
| NL@1km ↑ | 0.7089 | 0.4727 | 0.6442 | 0.6349 | 0.6839 |
Finding. Under transfer, the full model is best on Home/Work, Activity, NextLocation Top-1, and 1 km accuracy. Removing POIs degrades every metric and roughly doubles Duration MAE (80.8 → 166.7 min, −106.3%). Removing regional semantics costs 21.2% on Home/Work and 23.7% on Activity but slightly helps Anomaly and NextLocation Top-5. Removing the road graph improves NextActivity (0.7260) and Duration (70.6 min) at the expense of most other tasks. Replacing continuous coordinates with grid coordinates gives the best 500 m accuracy (0.6293) but lowers Activity by 33.7%. No single source ordering holds across tasks.
| Configuration | HW↑ | Act.↑ | NAct.↑ | Anom.↑ | Dur.↓ | NL@1↑ | NL@5↑ | NL@500m↑ | NL@1km↑ |
|---|---|---|---|---|---|---|---|---|---|
| StayBERT (full) | 0.7106 | 0.6036 | 0.3156 | 0.7603 | 69.6 | 0.3388 | 0.5529 | 0.3551 | 0.4776 |
| −POI | 0.6966 | 0.6119 | 0.3067 | 0.7244 | 167.3 | 0.2961 | 0.4915 | 0.3293 | 0.4101 |
| −LLM | 0.7023 | 0.5089 | 0.3029 | 0.7294 | 127.9 | 0.2879 | 0.2818 | 0.2130 | 0.2901 |
| −Road GNN | 0.7341 | 0.5915 | 0.3172 | 0.7252 | 71.5 | 0.2731 | 0.5954 | 0.3038 | 0.4106 |
| Grid coordinates | 0.7004 | 0.5723 | 0.2966 | 0.7274 | 115.1 | 0.3303 | 0.5722 | 0.3514 | 0.4049 |
Finding. In the source domain the full model is best on five of nine metrics (Anomaly 0.7603, Duration 69.6 min, and NextLocation Top-1, 500 m, and 1 km) and second on Home/Work, Activity, and NextActivity. Removing the road graph gives the best Home/Work (0.7341), NextActivity (0.3172), and Top-5 (0.5954). Removing POIs slightly improves Activity (0.6119) but raises Duration MAE to 167.3 min, and removing regional semantics drops NextLocation Top-5 from 0.5529 to 0.2818.
Citation
@misc{bao2026staybert,
title = {StayBERT: Staypoint Detection as the Pretext Task for Trajectory Foundation Models},
author = {Bao, Riyang and Tian, Mingke and Z{\"u}fle, Andreas and Zhao, Liang},
year = {2026},
note = {Under review}
}Key references
- D. Ashbrook and T. Starner. Using GPS to Learn Significant Locations and Predict Movement Across Multiple Users. Personal and Ubiquitous Computing 7(5), 2003.
- J. Lafferty, A. McCallum, and F. Pereira. Conditional Random Fields: Probabilistic Models for Segmenting and Labeling Sequence Data. ICML, 2001.
- G. Mai, Y. Xuan, W. Zuo, et al. Sphere2Vec: A General-Purpose Location Representation Learning over a Spherical Surface for Large-Scale Geospatial Predictions. ISPRS Journal of Photogrammetry and Remote Sensing 202, 2023.
- W. L. Hamilton, R. Ying, and J. Leskovec. Inductive Representation Learning on Large Graphs. NeurIPS, 2017.
- J. Jiang, D. Pan, H. Ren, X. Jiang, C. Li, and J. Wang. Self-Supervised Trajectory Representation Learning with Temporal Regularities and Travel Semantics. ICDE, 2023.
- D. Wang, E. Shelhamer, S. Liu, B. Olshausen, and T. Darrell. Tent: Fully Test-Time Adaptation by Entropy Minimization. ICLR, 2021.