3.1. Methods Overview
To aid the understanding of the multi-stage pipeline, a schematic overview is provided in
Figure 1. The diagram summarizes the methodological flow from raw Wi-Fi counts to preprocessing, temporal holdout, clustering, early same-day classification, evaluation, and deployment. This overview highlights how raw telemetry is transformed into interpretable typologies and how those typologies are used for real-time operational labeling. The pipeline is split into three parts, with the offline atlas representing the construction of daily demand centroids. The online part represents the real-time classification of partial-day signals via cosine matching. The evaluation part measures pipeline performance using preset metrics. As sketched in
Figure 1, the offline stage allowed for up to three lunchtime typologies, but the combination of silhouette width and prediction strength selected
k = 2 for the final atlas (Early Peak and Late Shift; see
Section 4).
This is a small-sample field feasibility/operational demonstration designed to test whether a frozen centroid + early-matching policy can be executed prospectively and yield directionally beneficial peak reductions under routine conditions. The sample size reflects resource and access constraints typical of service operations trials. A precision/estimation focus (one-sided HL lower bounds) was adopted rather than a high-powered effectiveness test. The artifact was intentionally designed to fit into routine smart-campus management workflows, requiring no per-day model fitting and exposing a single interpretable badge rather than a complex forecast. Methodologically, the contribution is not a new sensing modality or clustering algorithm, but an operationally complete design pattern: (1) a frozen, two-centroid typology atlas learned offline from Wi-Fi counts; (2) a reject-option early classification rule that triggers only under high similarity at a fixed decision time; and (3) a paired, nonparametric evaluation that reports a policy-relevant minimum gain via one-sided Hodges–Lehmann lower bounds. This combination is designed for low-maintenance deployment and auditable decision support using existing campus infrastructure.
Operational deployment steps and interface details are provided in the repository cited in the Data Availability Statement.
3.2. Setting and Data
The campus is part of a broader smart-city initiative and is equipped with pervasive Wi-Fi coverage, which is already used for IT operations and can be reused as an anonymized crowd-sensing layer [
40]. Service operations were observed in five campus canteens in Mae Fah Luang University (MFU), Thailand. Wi-Fi association counts from nearby access points were aggregated from 11:00 to 14:00 across three consecutive weekday weeks (4–26 September 2025). Weeks 1–2 were used for model selection, and Week 3 was held out for evaluation. The university operates an enterprise-grade Wi-Fi network across all teaching buildings and canteens. For this study, aggregate association counts published by the IT office via a dashboard and JSON API were used. Each record reports, for every access point covering a canteen, the number of active client associations at the end of each 7-min interval. The seven-minute step matches the update frequency of the underlying infrastructure. Device identifiers are anonymized by the university before aggregation. Raw MAC addresses and radio-level diagnostics are not available to the authors. Therefore, the Wi-Fi infrastructure is treated as an existing crowd-sensing layer, and the focus is on the analytics pipeline that transforms these aggregate counts into typologies and Early Peak badges.
Only aggregate counts were processed, and device identifiers were neither accessed nor stored for occupancy analysis on smart campuses [
4]. Wi-Fi associations were adopted as a pragmatic, privacy-preserving occupancy proxy, consistent with prior validation against camera ground truth [
8,
9,
41]. Days were excluded if more than 2 of the 26 bins were missing or if network outages were logged. Canteen capacities and AP coverage are given in
Table 1. The data was collected during weekdays of the first semester. Exam weeks and atypical event days were excluded so that the atlas captures routine lunchtime operations rather than exceptional surges.
AP association logs count devices, not people. The device-person ratio can drift with multi-device users, handset sleeping, and stationary devices, and coverage varies with AP placement. Prior facilities studies report strong correlations between AP connections and ground-truth occupancy, but they also recommend simple stabilizers (e.g., removing stationary devices, restricting to well-covered APs) and clear reporting of aggregation levels [
9]. In this study, light outlier damping and smoothing were applied when working with aggregate AP counts, and emphasis was put on shape (per-day z-scores) over magnitude for the early decision. Privacy was preserved by avoiding device identifiers and publishing only day-level results. De-identified Wi-Fi aggregate counts, analysis code, and entire pipeline code have been deposited to a repository referenced in the Data Availability Statement.
3.3. Preprocessing and Representation
To reduce the influence of rare spikes while preserving temporal shape, counts were winsorized at a high percentile and lightly smoothed with a short symmetric window. When binning to fixed 7 min intervals, canteen locations and days were indexed as
l and
d, respectively;
t index bin starts within [11:00, 14:00) at a fixed step Δ = 7, giving
T = 26 bins. For an event at minute-of-day
m, the bin start was computed as
Per canteen-day, counts were aggregated (summed) into the bin starts {
t = 1,…,
T}. Missing bins after pivoting were filled with 0, producing a length-
T vector of raw counts:
To reduce the undue influence of extreme spikes while preserving ranking, a per-curve upper cap was applied. For each
, the
q-quantile (default
q = 0.995) was computed, and an upper-tail winsorized series was obtained:
Upper-only winsorization removes rare, harmful spikes while preserving the valley structure that retains lunch-rush timing. It aligns with the operational objective (reduce peaks) and avoids masking genuine quiet periods or data-quality issues. Local irregularities were reduced by using two-stage smoothing. In the first stage, the centered median value
m at time
t is found. It is the median of all the original
values from
h steps in the past (
t −
h) to
h steps in the future (
t + h):
The second stage filter takes the output from the first stage (4) and applies a standard moving average to it according to window width
w bins. Let
w be an odd window length and
h = (
w − 1)/2. The smoothed value at time
t was computed as
Only positions with a full window were smoothed. The first and last
h-bins remained unsmoothed. In this study,
w = 3 (
h = 1). Each canteen day was then standardized row-wise (zero mean, unit variance) so that later analysis emphasized shape rather than absolute magnitude. For each
, the mean and standard deviation were computed across the
T bins,
and z-scores were obtained with a small numerical guard ε (e.g., 10
−9):
The resulting 26-dimensional vectors (one per day) formed the input to clustering and early classification. All pre-specified analysis parameters and their operational rationale are listed in
Appendix A,
Table A1. All preprocessing steps (binning, winsorisation, smoothing, and row-wise z-scoring) are implemented in the open analysis code repository referenced in the Data Availability Statement, which mirrors the sequence described here.
3.4. Typology Discovery and Prefix-Based Matching
Recurring lunch-demand shapes were identified with an unsupervised procedure so that typologies could be discovered without labels. Each canteen-day was represented as a 26-bin vector (11:00–14:00, 7 min bins) and standardized row-wise to zero mean and unit variance so that distances emphasized shape rather than level [
16]. The standardized vectors were then partitioned by k-means with k-means++ seeding over
k ∈ {2,3,4}, a simple, fast choice that reduces sensitivity to poor initializations [
42,
43]. The Scikit-learn (v1.1.3) library was used to perform k-means++ seeding with the parameters of
n_init = 25,
max_iter = 300 (default), and
random_state = 42 (random seed).
The number of clusters
k was selected by average silhouette width (ASW), computed on the standardized vectors. The silhouette index provides an internal validity measure that balances within-cluster cohesion and between-cluster separation. Higher values indicate cleaner, more interpretable partitions. When ASW values were similar across neighboring
k (ties < 0.02), a parsimony rule (choosing the smaller
k) was applied to avoid over-segmenting the data, which aligns with best practice in clustering validity [
44]. A minimum cluster size of ≥ 10% and a mean silhouette ≥ 0.25 are required as pragmatic thresholds for a small-sample field feasibility demonstration (thresholds summarized in
Appendix A,
Table A2). ASW interpretation (≥0.25 = weak but non-spurious structure) follows standard guidance from Rousseeuw/Kaufman and summaries widely used in practice [
45].
Cluster stability was assessed with prediction strength (PS), an out-of-sample reproducibility index [
46]. For each split, the data were halved, then each half was clustered by k-means (25 restarts), and points in one half were assigned to the other half’s centroids. For every predicted cluster, the co-membership rate (share of point pairs that also co-occurred in the other half’s clustering) was computed. PS(
k) was the minimum of these rates across clusters, combined over directions, and averaged across many splits. The usual rule selects the largest
k with PS(
k) ≥ 0.8–0.9. Given the short horizon and modest sample, a feasibility screen of PS ≥ 0.75 was adopted. The chosen solution (
k = 2, PS = 0.785) passes this screen and also satisfies parsimony and silhouette considerations. Higher PS indicates a more reproducible structure. For deployment in other sites, or in terms of the atlas (centroids),
k, and the similarity gate τ were expected to be re-estimated using local historical data and a forward hold-out check.
Typologies were obtained by taking each cluster centroid and labeling it by its peak time (e.g., Early, Noon, Late). Centroids served as prototype shapes commonly used in operational analytics, aiding communication and mapping to simple playbooks [
47]. The resulting atlas was frozen for deployment, enabling stable same-day decisions and lowering maintenance relative to continuously retrained forecasting pipelines. Periodic offline refreshes (monthly or after semester changes) accommodate seasonality while preserving day-to-day consistency [
26,
48]. This discovery-then-freeze workflow aligns with standard guidance in time-series clustering surveys and clustering-validation literature, which emphasize (a) normalization for shape, (b) robust seeding/initialization, (c) explicit model selection with internal indices, and (d) clear reporting of cluster quality [
16,
42,
44]. The exact k-means++ initialization, clustering calls, and centroid-freezing steps are available in the same repository, including configuration files that reproduce all results.
Once clusters are frozen, they can be used for same-day classification operations by comparing the standardized five-bin prefix (11:00–11:28) for each canteen against the corresponding five-bin prefixes of the frozen centroids using cosine similarity. For a given canteen day, let denote the prefix and the centroid prefix for typology k. For all k, was computed, and the day was assigned to the typology with the largest similarity when . In the operational evaluation, an Early Peak badge is issued only when the provisional typology label is Early Peak, and the corresponding similarity sEarly Peak meets Early Peaks Early Peak ≥ τ. If the best-matching centroid corresponds to any other typology, or if the Early Peak label has cosine similarity sEarly Peak < τ = 0.90, no Early Peak badge is issued, and such days are treated as “no-action” cases in the operational evaluation.
In summary, the artifact is a two-cluster atlas (Early Peak and Late Shift) combined with a one-sided Early-only gate: only high-confidence Early Peak days trigger an Early Peak badge and actions. Late Shift and low-confidence days serve as “no-action” baselines for evaluation.
3.6. Statistical Analysis
The operational policy was pre-specified to act on days whose 11:28 prefix was classified as Early Peak with confidence (cosine similarity ≥ τ, at τ = 0.90). The operational impact of Early Peak badge guidance was evaluated using a matched-pairs design. Within each canteen–weekday combination, intervention days (i.e., days on which the standardized information action was delivered) were matched to the nearest prior non-intervention (no-action) day, yielding 20 canteen–weekday pairs, under a partial-interference assumption that actions at a given canteen do not materially affect other canteens on the same day. Cross-canteen spillovers are not estimated in the primary analysis.
The primary outcome, PeakProxy, was defined as the maximum standardized crowd density z-score in the 11:00–14:00 window. If the intervention shifts demand away from the peak or flattens it, the PeakProxy difference should move in the expected direction [
6]. Let
d1,...,
dn denote paired differences (non-intervention–intervention). Paired differences were analyzed with a one-sided Wilcoxon signed-rank test (alternative: reduction > 0). The paired effect was summarized by the Hodges-Lehmann (HL) estimator, defined as the median of the Walsh averages of the paired differences. This estimator is the standard location-shift estimate associated with the signed-rank procedure [
49]. The Hodges-Lehmann estimator was computed as the median of the
n(
n + 1)/2 Walsh averages,
for 1 ≤
i ≤
j ≤
n. For interval estimation, a one-sided 95% lower bound for HL was obtained using the bootstrap percentile method [
50]. For the bootstrap percentile CI,
B = 2000 resamples were drawn with replacement from the paired differences, and the HL estimator was recomputed on each resample. The generator was initialized with
seed = 42 (
numpy.random.default_rng(42), NumPy v1.24 so identical resamples are obtained across runs. Using 2000–5000 replications is common in practice for percentile CIs, and 2000 was adopted here as a balance of stability and runtime [
51]. Annotated analysis notebooks in the repository provide the full implementation of the matched-pair construction, Wilcoxon and Hodges-Lehmann calculations, and bootstrap procedures, enabling exact reproduction of all reported estimates.
Robustness of the matched-pairs result was assessed in two ways. First, repeated non-intervention baseline days within each canteen–weekday stratum were restricted to be used at most once (“unique-baseline” restriction). Second, leave-one-canteen-out re-estimation was conducted to diagnose whether the paired association was disproportionately driven by a single canteen. The analysis code has been included in the repository mentioned in the Data Availability Statement.
The matched-pairs design estimates the median difference in peak crowding between intervention days and the nearest prior non-intervention day within the same canteen and weekday, assuming peaks would have followed similar short-term trends without the information intervention. Because downstream actions were not standardized or fully observed, the causal effects of specific actions were not identified, and only an association with the standardized information intervention was estimated. Spillovers across canteens and longer-run adaptation were not identified and were treated as limitations.