SONATI: Spatio-temporal ocean neighbourhood asymmetric transformer for imputation of sparse, tabular data with uncertainty
Authors: Yvonne Jenniges, Boris Peter Koch, Maike Sonnewald, Sebastian Maneth
Organizations: Databases, University of Bremen, Bibliothekstraße 1, Bremen 28359, Bremen, Germany. · Ecological Chemistry, Alfred-Wegener-Institut, Helmholtz-Zentrum für Polar- und Meeresforschung, Am Handelshafen 12, Bremerhaven 27570, Bremen, Germany. · University of Applied Sciences, An der Karlstadt 8, Bremerhaven 27568, Bremen, Germany. · Department of Computer Science, University of California, 1 Shields Avenue, Davis 95616, CA, USA. · School of Oceanography, University of Washington, 1410 NE Campus Parkway, Seattle 98195, WA, USA.
Missing value imputation is often a prerequisite for downstream analyses. In oceanography, observational data are frequently structured in a tabular manner, highly sparse and exhibit spatio-temporal structures that classical imputers such as k-nearest neighbours or MissForest are not suited to exploit. We present the Spatio-temporal Ocean Neighbourhood Asymmetric Transformer for Imputation (SONATI), a masked, factorised time-space transformer operating on pre-computed, local time and space neighbourhoods, which reduces computational complexity compared to global attention. SONATI is designed to work with tabular data and is thus in principle able to work on both gridded and unstructured data, though evaluation here was performed on gridded North Atlantic data only. It provides aleatoric and epistemic uncertainties through a negative log-likelihood loss and multiple forward passes with Monte Carlo dropout. Systematic ablations on attention type and masking strategies guided the final architecture design. The results showed that SONATI outperformed classical and transformer-based methods by at least 12.5% in terms of root mean squared error (RMSE) on a large observational oceanographic dataset with key biogeochemical and physical parameters in the North Atlantic (potential temperature, salinity, oxygen, nitrate, silicate and phosphate). Attention type and masking strategy strongly affected imputation accuracy and smoothness of the produced oceanographic fields. Best results were achieved by factorised time-space attention and combined geographic and per-sample masking. The combined masking strategy reduced the imputation error by 14.3% compared to per-sample masking only. Uncertainties were moderately well calibrated (miscalibration area at observed locations 0.074±0.012) and moderately correlated with the imputation error.
Figures & tables
Figure 1: Data missingness, i.e. the percentage of the six parameters missing in a grid cell, averaged over time steps at selected depth levels. Grey indicates ocean cells without data and light grey shows land
Figure 2: Architecture of SONATI, a time-space factorised masked transformer designed to impute missing input data. The input consists of a query token and its spatio-temporal neighbours. Each token contains oceanographic features and missingness masks for each feature, which are first passed through a small neural network we call a feature mixer, and spatio-temporal information. Pre-computed temporal and spatial k-nearest neighbours (KNN) graphs are then used to infer neighbours of each query point. This information is passed to the transformer, i.e. first through an embedding layer, then through n layers of temporal cross attention and subsequently through m layers of spatial cross attention. The cross-attention is one-directional, i.e. the query only attends to the neighbours. Finally, the mean head outputs the imputed values, the variance head outputs aleatoric uncertainties. For training, both outputs are passed to a heteroscedastic negative log-likelihood loss
Model
RMSE ↓
KGE ↑
CMIP6 MAE ↓
MLP
0.1322 ± 0.0595
− 1.36 ± 3.70
0.0228 ± 0.0008
Mean
0.1233
− 0.41
0.0602
KNN
0.0461
0.86
0.0300
MissForest
0.0295 ± 0.0002
0.90 ± 0.01
0.0244 ± 0.0004
ReMasker
0.0289 ± 0.0004
0.84 ± 0.01
0.0233 ± 0.0008
SONATI
0.0253 ± 0.0003
0.93 ± 0.01
0.0220 ± 0.0001
Table 1: Imputation results of the six tuned models on the test set in [0,1] -scaled space. Root mean squared error (RMSE) was computed across all test values and hence weights parameters by their number of test observations. Kling-Gupta efficiency (KGE) is the median across parameters per run. The mean absolute error (MAE) to CMIP6 simulation data was computed at originally missing positions and averaged across parameters. Values are reported as mean ± standard deviation across five model runs with different seeds. Mean imputation and KNN are deterministic and were run once
Model
Potential temperature
Salinity
Oxygen
Nitrate
Silicate
Phosphate
MLP
0.2388 ± 0.1342
0.0776 ± 0.0139
0.0894 ± 0.0157
0.0381 ± 0.0122
0.0457 ± 0.0084
0.0301 ± 0.0095
Mean
0.1934
0.0919
0.1417
0.0277
0.0444
0.0241
KNN
0.0613
0.0391
0.0578
0.0141
0.0378
0.0147
MissForest
0.0410 ± 0.0002
0.0133 ± 0.0002
0.0391 ± 0.0005
0.0113 ± 0.0001
0.0274 ± 0.0002
0.0168 ± 0.0009
ReMasker
0.0366 ± 0.0002
0.0137 ± 0.0003
0.0410 ± 0.0011
0.0131 ± 0.0002
0.0307 ± 0.0005
0.0141 ± 0.0004
SONATI
0.0317 ± 0.0005
0.0129 ± 0.0010
0.0356 ± 0.0011
0.0100 ± 0.0002
0.0281 ± 0.0005
0.0119 ± 0.0010
Table 2: Root mean squared error (RMSE) of the six tuned models on the test set per [0,1] -scaled parameter. Standard deviations are reported across five model runs with different seeds
Figure 3: Imputation of potential temperature by a multi-layer perceptron (MLP), k-nearest neighbours (KNN) algorithm, MissForest, ReMasker and the novel SONATI, averaged over time and five seeds at three selected depth levels. KNN is deterministic and was hence run once. Grey indicates ocean cells without data and light grey shows land
Figure 4: Standard deviation over time of the seed-averaged potential temperature imputation at three selected depth levels, generated by a multi-layer perceptron (MLP), k-nearest neighbours (KNN) algorithm, MissForest, ReMasker and the novel SONATI. KNN is deterministic and was hence run once. Grey indicates ocean cells without data and light grey shows land
Figure 5: Mean differences (five-seed-averaged imputation − CMIP6 simulation data) of potential temperature at originally missing grid cells for imputations by a multi-layer perceptron (MLP), k-nearest neighbours (KNN) algorithm, MissForest, ReMasker and the novel SONATI, averaged over time at three selected depth levels. Grey indicates ocean cells without data and light grey shows land
Figure 6: Comparison of attention mechanisms with and without a feature mixer, which received features as input and optionally missingness masks. The plot shows the RMSE computed across all test values, pooled over features, space and time as mean and standard deviation over five seeds
Figure 8: RMSE of time-space attention under various masking strategies, applied alone and in combination, evaluated on the 15\SIUnitSymbolDegree -block validation set (left) and the corresponding fraction of hidden values (right). Columns denote the number of features masked per data point in addition to the row’s masking strategy. The first column corresponds to that strategy applied on its own, without extra per-sample masking. The first row shows per-sample masking alone. The middle rows combine per-sample masking with cylindrical masking (spatial radius r∈{0.1,0.3,0.5,0.7,0.9} ), simulating regional data gaps and transect masking (width w∈{0.02,0.05} ), simulating ship-track gaps, applied in a random or grid-aligned direction. The last row shows per-sample, transect and cylindrical masking simultaneously. Cell colour encodes RMSE magnitude, while hatching indicates the coefficient of variation of RMSE across the five seeds for that cell, min-max normalised within the heatmap. Denser hatching marks a less stable RMSE across seeds
Figure 9: Uncertainty calibration per feature ±1 standard deviation across five seeds, with a dashed line indicating ideal calibration
Appendix figures & tables17 assets
Supplementary material from the paper’s appendix.
Appendix
Figure A1: Mean missingness, i.e. the percentage of the six parameters missing in a grid cell averaged over grid cells, time steps and parameters, versus time-bin width as blue points. The orange line displays a fitted, smooth spline (UnivariateSpline, Python library scipy, version 1.16.2, smoothing factor s=10 ) on which the elbow is computed (Python library kneed, version 0.8.5, concave and decreasing curve, default sensitivity S=1 ). The elbow at an 11-year time step size represents the trade-off between data availability and time resolution
Figure A2: Per-parameter missingness per 20-year time step, i.e. the percentage of grid cells with no measurement of the parameter. Salinity was generally best sampled, closely followed by temperature, while nutrient data was sparser. Missingness was lowest for all features in the time step starting in the year 1972
Potential temperature
Salinity
Oxygen
Nitrate
Silicate
Phosphate
Spatial range [km]
6246
10869
7845
7051
10631
10860
Spatial sill
42.0
23.9
4956.1
61.2
297.7
0.7
Spatial nugget
11.2
0.0
0.0
58.2
25.8
0.0
Depth range [m]
2192
358
4000
303
4000
4000
Depth sill
20.8
0.0
0.0
0.1
435.6
0.0
Depth nugget
31.7
6.2
2892.5
93.8
0.0
0.4
Appendix
Table B1: Summary of variogram analysis (Python library scikit-gstat, version 1.0.21) of six oceanographic parameters in the North Atlantic. Variograms were computed on 10,000 randomly drawn observed grid cells per parameter from the 20-year gridded dataset using unscaled values and separately for horizontal space (latitude and longitude), depth and time. Horizontal coordinates were transformed to kilometres using a Lambert azimuthal equal-area projection, while depth is reported in metres and temporal lags in years. The variogram sill (plateau semivariance) and nugget (unresolved small-scale variability and measurement noise) are given in squared parameter units ([ \SIUnitSymbolCelsius ] 2 , [psu] 2 , [ \SIUnitSymbolMicromolkg−1 ] 2 ). The range is the lag distance at which the semivariance approaches the sill
Figure B1: Temporal autocorrelations for six oceanographic parameters in the North Atlantic. Each cell shows the autocorrelation at a 20-year lag. For the nutrients, lags without a value occurred as fewer time steps contained respective data. Temperature, salinity and oxygen decorrelate rapidly indicating limited temporal persistence at the considered resolution. Nutrients show slightly stronger short-lag correlations and oscillations at medium lags, suggesting modest multi-decadal correlation
Figure B2: Histograms of all observed values per parameter with kernel density estimates (bin numbers set automatically by seaborn , version 0.13.2) in the 20-year gridded dataset (637,390 grid cells, of which 55,349 to 159,907 have a value per parameter). The long upper tails of nitrate, silicate and phosphate mostly originate from a few extreme values in river-influenced coastal waters and the Black Sea
Model
Hyperparameter
Values
SimpleImputer
strategy
mean, median
KNN
n_neighbors
1 – 50
weights
uniform, distance
MissForest
n_estimators
50 – 200
max_features
None, sqrt, 0.5
ReMasker
batch_size
64, 128, 256, 512
Appendix
Table C1: Hyperparameters and their ranges explored in the Optuna tuning studies. Comma-separated lists indicate discrete values, while dash-separated numbers indicate a continuous range that Optuna optimisation could choose from
Table C2: Best hyperparameter combinations for each imputation model obtained from Optuna studies. The hyperparameters are sorted according to their hyperparameter importance, which was computed with Optuna’s fANOVA implementation. No importance (–) was reported for cylinder_mask_radius due to the way the study was set up. The validation RMSE was computed in [0,1] -scaled space. The duration measures the time per trial, which consisted of training the model on each of the five train-validation splits. Note that the standard models were tuned on CPU nodes of a high-performance system, while the neural networks were tuned on GPU nodes
Model
Potential temperature
Salinity
Oxygen
Nitrate
Silicate
Phosphate
MLP
0.40 ± 0.32
0.50 ± 0.11
0.52 ± 0.12
− 6.27 ± 7.69
− 53.89 ± 120.55
− 48.62 ± 108.46
Mean
− 0.42
− 0.41
− 0.41
− 0.41
− 0.41
− 0.41
KNN
0.92
0.87
0.89
0.84
0.65
0.76
MissForest
0.97 ± 0.00
0.97 ± 0.00
0.96 ± 0.00
0.83 ± 0.01
0.72 ± 0.02
0.75 ± 0.02
ReMasker
0.97 ± 0.00
0.98 ± 0.01
0.92 ± 0.01
0.75 ± 0.02
0.69 ± 0.02
0.69 ± 0.03
SONATI
0.98 ± 0.00
0.97 ± 0.02
0.95 ± 0.01
0.91 ± 0.02
0.69 ± 0.02
0.82 ± 0.04
Appendix
Table D1: Kling-Gupta efficiency (KGE) per [0,1] -scaled parameter for each model (mean ± standard deviation across five seeds). KNN and mean imputation are deterministic and therefore have no spread
Model
Potential temperature [ \SIUnitSymbolCelsius ]
Salinity [psu]
Oxygen [ \SIUnitSymbolMicromolkg−1 ]
Nitrate [ \SIUnitSymbolMicromolkg−1 ]
Silicate [ \SIUnitSymbolMicromolkg−1 ]
Phosphate [ \SIUnitSymbolMicromolkg−1 ]
MLP
1.298 ± 0.103
0.269 ± 0.011
18.925 ± 0.217
3.714 ± 0.311
6.629 ± 0.213
0.233 ± 0.007
Mean
5.558
0.646
41.650
5.993
11.779
0.408
KNN
1.634
0.354
24.195
4.891
9.923
0.289
MissForest
1.107 ± 0.013
0.280 ± 0.005
20.907 ± 0.166
3.507 ± 0.069
9.573 ± 0.496
0.237 ± 0.002
ReMasker
1.209 ± 0.071
0.305 ± 0.017
20.050 ± 0.556
3.442 ± 0.495
7.510 ± 0.272
0.227 ± 0.011
SONATI
1.135 ± 0.014
0.262 ± 0.010
20.203 ± 0.275
3.529 ± 0.033
6.200 ± 0.141
0.231 ± 0.013
Appendix
Table D2: Mean absolute differences of the imputed fields with CMIP6 simulation data for each model in physical units across five seeds. KNN and mean imputation are deterministic and therefore have no spread
Model
Potential temperature
Salinity
Oxygen
Nitrate
Silicate
Phosphate
MLP
0.0392 ± 0.0031
0.0067 ± 0.0003
0.0431 ± 0.0005
0.0116 ± 0.0010
0.0255 ± 0.0008
0.0104 ± 0.0003
Mean
0.1679
0.0162
0.0948
0.0188
0.0453
0.0181
KNN
0.0494
0.0089
0.0551
0.0153
0.0381
0.0129
MissForest
0.0335 ± 0.0004
0.0070 ± 0.0001
0.0476 ± 0.0004
0.0110 ± 0.0002
0.0368 ± 0.0019
0.0106 ± 0.0001
ReMasker
0.0365 ± 0.0022
0.0077 ± 0.0004
0.0457 ± 0.0013
0.0108 ± 0.0016
0.0289 ± 0.0010
0.0101 ± 0.0005
SONATI
0.0343 ± 0.0004
0.0066 ± 0.0002
0.0460 ± 0.0006
0.0111 ± 0.0001
0.0238 ± 0.0005
0.0103 ± 0.0006
Appendix
Table D3: Mean absolute differences of the imputed [0,1] -scaled fields with CMIP6 simulation data for each model across five seeds. KNN and mean imputation are deterministic and therefore have no spread
Figure E1: Kling-Gupta efficiency (KGE, median across parameters, left) and mean absolute error (MAE) to CMIP6 simulation data (right) of time-space attention under various masking strategies, applied alone and in combination, evaluated on the 15\SIUnitSymbolDegree -block validation set. Columns denote the number of features masked per data point in addition to the row’s masking strategy. The first column corresponds to that strategy applied on its own, without extra per-sample masking. The first row shows per-sample masking alone. The middle rows combine per-sample masking with cylindrical masking (spatial radius r∈{0.1,0.3,0.5,0.7,0.9} ), simulating regional data gaps and transect masking (width w∈{0.02,0.05} ), simulating ship-track gaps, applied in a random or grid-aligned direction. The last row shows per-sample, transect and cylindrical masking simultaneously. Cell colour encodes the magnitude of the respective error metric, while hatching indicates the coefficient of variation across the five seeds for that cell, min-max normalised within the heatmap. Denser hatching marks a less stable metric across seeds
Mask ratio
RMSE ↓
KGE ↑
CMIP MAE ↓
0.1
0.0400 ± 0.0028
0.82 ± 0.04
0.0228 ± 0.0010
0.2
0.0338 ± 0.0019
0.88 ± 0.03
0.0230 ± 0.0004
0.3
0.0333 ± 0.0018
0.88 ± 0.02
0.0228 ± 0.0009
0.4
0.0330 ± 0.0020
0.87 ± 0.02
0.0236 ± 0.0005
0.5
0.0330 ± 0.0019
0.86 ± 0.02
0.0232 ± 0.0003
0.6
0.0326 ± 0.0019
0.88 ± 0.02
0.0233 ± 0.0007
Appendix
Table E2: Performance of different mask ratios for per-feature masking on a time-space factorised transformer across five seeds. KGE is the median across parameters
Figure E2: Imputed potential temperature fields produced by time-space attention without a feature mixer (mask ratio of 0.3), with a feature mixer (on features and missingness masks and a mask ratio of 0.3) and with a feature mixer (best masking configuration from the ablation) at the surface level in two selected 20-year bins (1772 and 2012), averaged across five seeds. Grey indicates ocean cells without data and light grey shows land
Feature
Mean of z
Std of z
Number of observations
Potential temperature
0.027 ± 0.113
0.887 ± 0.021
143,933
Salinity
− 0.043 ± 0.163
0.829 ± 0.024
159,907
Oxygen
0.058 ± 0.132
0.929 ± 0.049
131,326
Nitrate
0.093 ± 0.190
0.888 ± 0.056
55,349
Silicate
0.062 ± 0.164
0.937 ± 0.068
69,043
Phosphate
− 0.099 ± 0.297
0.939 ± 0.063
81,744
Appendix
Table F1: Standardised residuals (z-scores) per feature (mean ± standard deviation across five seeds), computed as z=(y−y^)/σ^total from the observed value y , the predicted mean y^ and the predicted total uncertainty σ^total (all in [0,1] -scaled units), over all observed grid cells. The last column gives the number of observed values per feature
Figure F1: Spearman’s ρ between the total uncertainty and the squared error per feature in [0,1] -scaled units, computed over all observed grid cells. The bars show the mean across five seeds and the whiskers ± one standard deviation across seeds
Figure F2: Boxplot of epistemic and aleatoric uncertainty distributions (standard deviation in [0,1] -scaled units, log scale) per feature, pooled across all 637,390 grid cells, including cells without any observation, and five seeds. Whiskers extend to values within 1.5 times the interquartile range and circles mark values beyond. The number above each feature is the factor by which the aleatoric median exceeds the epistemic median, computed on the non-log-transformed values
Figure F3: Spearman’s ρ between the epistemic and aleatoric uncertainty and the missingness of a grid cell per feature, computed over all 637,390 grid cells. Missingness is the fraction of the six parameters without an observation in that cell. Cell values are the mean ± standard deviation across five seeds
Multivariate time series imputation is fundamental in applications such as healthcare, traffic forecasting, and biological modeling, where sensor failures and irregular sampling lead to pervasive missing values. Existing Transformer- and diffusion-based imputers achieve strong performance, but they often rely mainly on time-domain modeling and lack adaptive spectral bias for recovering structured temporal gaps. We propose FADTI, a Fourier- and attention-driven diffusion framework for multivariate time series imputation. FADTI introduces a Fourier Bias Projection (FBP) module that injects learnable frequency-aware bias into intermediate hidden states during denoising. It projects intermediate hidden states onto Fourier bases, avoiding direct spectral estimation from masked or zero-filled inputs. With DFT, STFT, and FSST instantiations, FBP captures global periodicity, localized time--frequency variations, and non-stationary oscillatory patterns. By coupling FBP with self-attention and gated convolution, FADTI integrates frequency-domain guidance, temporal dependency modeling, and probabilistic denoising in a unified framework. Experiments on multiple benchmarks, including a new biological imputation benchmark, show that FADTI improves accuracy, uncertainty estimation, and sampling efficiency, especially under high missing rates and structured missing patterns. Code is available at https://github.com/RazeenLI/FADTI
Runze Li, Hanchen Wang, Wenjie Zhang +4
University of New South Wales, Australia · University of Technology Sydney, Australia · The Chinese University of Hong Kong, Shenzhen, China
Streaming sensor applications routinely suffer from delayed or missing observations caused by faults, communication losses, or environmental interference. Although recent imputation methods exploit temporal and spatial dependencies effectively, most either assume offline access to future observations or prioritize throughput without enforcing domain plausibility. We present TSGuard, a real-time demonstration system for monitoring, validating, and imputing missing values in streaming time series. TSGuard combines a lightweight graph-aware temporal imputation model with constraint-aware validation, fallback estimation, and operator-facing explanations. Rather than treating imputation as an isolated prediction task, TSGuard integrates it into a broader data-quality loop: detect problematic observations, impute missing values, validate estimated against physical and spatial constraints, and either retain the original value as a plausible anomaly or replace it when it violates domain constraints. Using environmental sensing as a motivating setting, the demo enables users to inspect delayed sensors, compare imputers, define constraints, and validate flagged values in real time. The combination of lightweight online spatiotemporal imputation, domain-aware validation, and explicit retain-or-replace decisions is our central contribution, while interactive explanations make these decisions inspectable and actionable. for operators.
Imane Hocine, Asma Abboura, Soror Sahri +3
University of Luxembourg Luxembourg · Hassiba Benbouali University of Chlef Algeria · Université Paris Cité France +1
Missing data imputation in large-scale surveys faces two challenges that are not well handled by current tabular diffusion methods. First, structural skips, cells made inapplicable by questionnaire design, should not be imputed but are often conflated with item nonresponse. Second, ordinal responses encode ordered categories, yet most pipelines treat them as nominal levels through one-hot or analog-bit encodings. We introduce TabSODA (Tabular diffusion with Skip pattern detection and Ordinal Awareness), an Expectation-Maximization (EM)-based diffusion imputer built on the Elucidated Diffusion Model (EDM) framework. TabSODA propagates structural skips through the denoising loss and reverse-time sampler, and represents ordinal variables with cumulative-probit scalar latents while retaining analog-bit encodings for nominal variables. When a codebook skip mask is available, TabSODA uses it directly; otherwise, the TabSODA+SKIP variant estimates the mask from raw responses and questionnaire order using a CART-based skip-pattern miner. On Population Assessment of Tobacco and Health (PATH) study and the National Survey on Drug Use and Health (NSDUH), two nationally representative U.S.\ surveys, TabSODA reduces ordinal MACE by up to 23.7% and improves categorical accuracy by up to 9% over the strongest baseline across MCAR, MAR, and MNAR masking. The skip miner achieves near-perfect precision on both datasets, allowing TabSODA+SKIP to closely track the codebook-mask variant.
Yuyu Chen, Taehyo Kim, Hai Shu +1
Department of Biostatistics NYU School of Global Public Health