---
title: Temporal-Spectral Alignment with Frequency Adaptation
url: https://www.emergentmind.com/topics/temporal-spectral-alignment-with-frequency-adaptation-safa
type: topic
---

# Temporal-Spectral Alignment with Frequency Adaptation

Searching arXiv for the core SAFA paper and a few closely related time-series adaptation references to ground the article.
Temporal-Spectral Alignment with Frequency Adaptation (SAFA) is a method for source-free domain adaptation (SFDA) in time-series classification that transfers a pretrained source model to an unlabeled target domain without access to source data, while addressing both feature shift and temporal drift [2606.23120]. In SAFA, the source domain is modeled with temporal masking and feature-space imputation, and target adaptation is performed by inserting a Frequency Adaptation Layer (FAL) before a frozen source model. The defining idea is to adapt target signals at the signal level by transforming them with FFT, modulating amplitude and phase, and reconstructing them with iFFT so that the adapted target sequence aligns spectrally with the source while remaining temporally plausible for classification [2606.23120].

## 1. Problem formulation and motivation

SAFA is defined in the setting of source-free domain adaptation for multivariate time-series classification. The source domain is a labeled dataset
\[
\mathcal{D}_s = \{(x_i^s, y_i^s)\}_{i=1}^{n_s}, \quad x_i^s \in \mathbb{R}^{T \times C},\ y_i^s \in \{1,\dots,K\},
\]
while the target domain is an unlabeled dataset
\[
\mathcal{D}_t = \{x_j^t\}_{j=1}^{n_t}, \quad x_j^t \in \mathbb{R}^{T \times C}.
\]
The two domains share the label space, but satisfy \(P_s(X, Y) \neq P_t(X, Y)\). The source model is trained as \(f_s = h_s \circ g_s\), with a feature extractor \(g_s\) and classifier \(h_s\), using source-domain cross-entropy [2606.23120].

The source-free constraint is central. During adaptation, source data \(\mathcal{D}_s\) is not available because of privacy, storage, or transmission constraints; only the pretrained source model \(f_s\) and unlabeled target data \(\mathcal{D}_t\) are available. The objective is therefore not to retrain on joint data, but to obtain a target model \(f_t\) that performs well on \(\mathcal{D}_t\) under these restrictions [2606.23120].

SAFA is motivated by the observation that, in time series, domain shift is not exhausted by conventional feature mismatch. The method distinguishes **feature shift**, including changes in dominant frequencies, amplitudes, and phase patterns, from **temporal drift**, including earlier or later event occurrence, activity-speed variation, and time-varying segment shape. The paper argues that standard SFDA methods that only adjust feature extractor parameters may not directly manipulate the signal-level spectral structure where the shift is most evident. This is the specific gap SAFA is designed to fill [2606.23120].

## 2. Source-domain modeling and architectural design

The source backbone in SAFA consists of three components. The feature extractor \(g_s\) is a 1D CNN with 3 convolutional blocks, each followed by BatchNorm, ReLU, and MaxPooling, and then an adaptive average pooling layer that produces a fixed-size latent representation. The classifier \(h_s\) is a single linear layer mapping latent features to class logits. The temporal imputer \(j_s\) is an LSTM-based network that operates in feature space and reconstructs features of the original sequence from features of a masked sequence [2606.23120].

Source modeling is explicitly temporal-spectral, but its temporal and spectral parts appear in different stages. On the temporal side, SAFA performs block-wise random masking along time on the input sequence. For a source sample \(x^s \in \mathbb{R}^{T\times C}\), a binary mask \(M \in \{0,1\}^T\) is constructed and broadcast over channels to obtain
\[
\tilde{x}^s = x^s \odot M.
\]
The feature extractor produces
\[
z^s = g_s(x^s), \quad \tilde{z}^s = g_s(\tilde{x}^s),
\]
and the imputer reconstructs
\[
\hat{z}^s = j_s(\tilde{z}^s).
\]
The temporal imputation loss is
\[
\mathcal{L}_{imp}^{s} = \mathbb{E}_{x^s \in \mathcal{D}_s} \left\| g_s(x^s) - j_s\big(g_s(\tilde{x}^s)\big) \right\|_2^2.
\]
Combined with the source classification loss, the source objective is
\[
\mathcal{L}_{source} = \mathcal{L}_{ce}^{s} + \mathcal{L}_{imp}^{s}.
\]
This training makes \(g_s\) temporally robust and turns \(j_s\) into what the paper characterizes as a temporal structure verifier [2606.23120].

The paper interprets this design as multi-scale temporal-spectral modeling. Convolutions, pooling, and LSTM dynamics capture multi-step temporal dependency structure, while the later frequency adaptation stage supplies global frequency decomposition over frequency bins. A common misunderstanding is to read SAFA as a purely spectral adapter; in fact, its temporal side is built into source pre-training through masking and imputation, and its spectral side is introduced during target adaptation through FAL [2606.23120].

## 3. Frequency Adaptation Layer and signal-level alignment

The Frequency Adaptation Layer is the core innovation of SAFA. During adaptation, the entire source model is frozen: \(g_s\), \(h_s\), and \(j_s\) receive no gradient updates. FAL is inserted before the feature extractor and is the only trainable component. This makes SAFA a signal-level adaptation paradigm rather than a conventional feature-space self-training procedure [2606.23120].

Given a target sequence \(x^t \in \mathbb{R}^{T \times C}\), FAL first applies FFT along time:
\[
X^t = \mathrm{FFT}(x^t),
\]
where \(X^t \in \mathbb{C}^{F \times C}\). It then decomposes the spectrum into amplitude and phase,
\[
\mathcal{A} = |X^t|, \qquad \Phi = \angle X^t.
\]
Two MLPs, \(\mathcal{M}_{amp}\) and \(\mathcal{M}_{phase}\), predict residual-style perturbations
\[
\Delta \mathcal{A} = \tanh(\mathcal{M}_{amp}(\mathcal{A})) \cdot \alpha,
\qquad
\Delta \Phi = \tanh(\mathcal{M}_{phase}(\Phi)) \cdot \beta,
\]
where \(\alpha\) and \(\beta\) are scaling hyperparameters, and \(\tanh\) bounds perturbations in \((-1,1)\). The MLP weights are initialized to zero so that initially
\[
\Delta \mathcal{A} = 0, \qquad \Delta \Phi = 0,
\]
which makes FAL an identity mapping at the start of adaptation [2606.23120].

The perturbation is multiplicative:
\[
\hat{\mathcal{A}} = \mathcal{A} \odot (1 + \Delta \mathcal{A}), \qquad
\hat{\Phi} = \Phi \odot (1 + \Delta \Phi).
\]
The paper interprets this as a frequency-selective, learnable filter that can emphasize source-like frequency ranges, attenuate domain-specific noise bands, and adjust phase structure to better match source-domain patterns. The adapted spectrum is recombined as
\[
\hat{X}^t = \hat{\mathcal{A}} \cdot e^{i\hat{\Phi}},
\]
and mapped back to the time domain by
\[
\hat{x}^t = \mathrm{iFFT}(\hat{X}^t).
\]
The adapted sequence is then processed by the frozen source model:
\[
z^t = g_s(\hat{x}^t), \qquad p = \sigma(h_s(z^t)).
\]
A frequent misconception is that SAFA performs generic frequency-domain augmentation. More precisely, it learns amplitude and phase perturbations as target-specific trainable modulations whose sole purpose is to move target signals into a regime where a frozen source model remains effective [2606.23120].

## 4. Adaptation objectives and source-free training dynamics

During adaptation, only the FAL parameters
\[
\Theta_{FAL} = \{\mathcal{M}_{amp}, \mathcal{M}_{phase}\}
\]
are optimized. The alignment objective combines information maximization with a temporal consistency constraint derived from the frozen imputer [2606.23120].

The first part is the Information Maximization (IM) loss. For target sample \(x_j^t\), let
\[
p_j = \sigma\big(h_s(g_s(\hat{x}_j^t))\big) \in \mathbb{R}^K.
\]
Entropy minimization is defined as
\[
\mathcal{L}_{ent}^{t} = - \mathbb{E}_{x^t \in \mathcal{D}_t} \sum_{k=1}^K p_j^{(k)} \log p_j^{(k)},
\]
which encourages confident predictions. Diversity maximization uses the batch-average prediction
\[
\bar{p} = \mathbb{E}_{x^t \in \mathcal{D}_t}[p_j]
\]
and
\[
\mathcal{L}_{div}^{t} = - \sum_{k=1}^K \bar{p}^{(k)} \log \bar{p}^{(k)},
\]
which prevents collapse to a single class. Their combination is
\[
\mathcal{L}_{IM}^{t} = \mathcal{L}_{ent}^{t} - \lambda_{div}\,\mathcal{L}_{div}^{t}.
\]
Minimizing this loss lowers per-sample entropy while increasing batch-level diversity [2606.23120].

The second part is the Temporal Output Verification (TOV) loss. Using the adapted features \(z^t = g_s(\hat{x}^t)\), SAFA defines
\[
\mathcal{L}_{TOV}^{t} = \mathbb{E}_{x^t \in \mathcal{D}_t} \left\| z^t - j_s(z^t) \right\|_2^2.
\]
The role of the frozen LSTM imputer \(j_s\) is not to predict labels, but to act as a temporal manifold verifier. If FAL modifies the spectrum in a way that produces temporally implausible feature trajectories, reconstruction error grows. The overall target objective is
\[
\mathcal{L}_{total}^{t}
=
\mathcal{L}_{ent}^{t}
-
\lambda_{div}\mathcal{L}_{div}^{t}
+
\lambda_{tov}\mathcal{L}_{TOV}^{t}.
\]
This objective couples spectral alignment and temporal plausibility: predictions must become confident and diverse, but adapted features must remain on the source temporal manifold [2606.23120].

The training procedure is two-stage. In Stage 1, \(g_s\), \(h_s\), and \(j_s\) are jointly trained on the source domain with classification and imputation losses. In Stage 2, the source model \(\Theta_s = \{g_s,h_s,j_s\}\) is frozen, FAL is initialized as the identity, and each target batch is processed through FFT, amplitude/phase perturbation, iFFT reconstruction, frozen inference, IM loss computation, and TOV loss computation. Only \(\Theta_{FAL}\) is updated. The paper explicitly attributes adaptation stability to this freezing strategy and to the fact that no backpropagation through deep network parameters is needed during target adaptation [2606.23120].

## 5. Experimental evidence, ablations, and implementation characteristics

SAFA is evaluated on three benchmark families. **WISDM** uses smartphone accelerometer data from 36 subjects, with 6 classes, 3 channels, length 128, and 36 cross-subject domain scenarios. **Machinery Fault Database (MFD)** uses vibration signals for rotating machinery fault diagnosis, with 3 classes, 1 channel, length 5120, and 4 scenarios. **Boiler** uses industrial boiler fault detection data, with 2 classes, 20 channels, length 36, and 3 scenarios [2606.23120].

The baselines include image-style SFDA methods adapted to time series—SHOT, NRC, and AaD—and time-series-specific SFDA methods MAPU, TemSR, and CE-SFDA. The paper states that existing time-series SFDA works such as MAPU and TemSR use temporal masking, pseudo-labeling, and feature-level adaptation, but do not explicitly model or adjust the frequency spectrum [2606.23120].

| Dataset | SAFA average Macro F1 (%) | Next best |
|---|---:|---:|
| MFD | 86.12 | CE-SFDA: 83.02 |
| WISDM | 65.40 | CE-SFDA: 60.91 |
| Boiler | 64.67 | TemSR: 57.38 |

On MFD, SAFA is reported as best or second-best on almost all 9 transfer scenarios and is particularly strong on challenging transfers such as \(0 \to 1\) and \(3 \to 0\). On WISDM, it outperforms baselines by about 4.5 MF1 on average and is notably stronger on transfers such as \(26 \to 2\) and \(7 \to 30\). On Boiler, it reaches 90.57 MF1 on task \(1 \to 3\) [2606.23120].

The ablation study on MFD isolates three components: FAL, TOV, and frozen backbone. Full SAFA reaches 86.12 MF1. Removing FAL reduces performance to 66.29 MF1, removing TOV gives 78.06 MF1, and allowing the backbone \(g_s\) to update yields 79.18 MF1. The paper interprets these results as evidence that FAL is the main driver of spectral alignment, TOV improves temporal regularisation, and freezing the source model avoids forgetting and instability [2606.23120].

Implementation is in PyTorch. FFT is applied per channel along the time dimension, and FAL uses two small fully-connected networks with \(\tanh\) to predict \(\Delta\mathcal{A}\) and \(\Delta\Phi\). Adaptation learning rates are \(1\mathrm{e}{-5}\) for MFD, \(1\mathrm{e}{-3}\) for WISDM, and \(1\mathrm{e}{-4}\) for Boiler, with weight decay \(10^{-4}\), 40/50/30 epochs, and batch sizes 32/64/32 for MFD, WISDM, and Boiler respectively. Example frequency scales are amp \(\approx 0.80\), phase \(\approx 1.70\) for MFD, and amp \(\approx 0.77\), phase \(\approx 0.88\) for WISDM and Boiler. The paper characterizes FAL as lightweight because FFT/iFFT are efficient, only two small MLPs are trainable, and the feature extractor and classifier are frozen [2606.23120].

## 6. Position within temporal-spectral research, limitations, and interpretation

Within source-free time-series adaptation, SAFA is positioned against methods that adapt feature extractors or rely on temporal reconstruction without explicit spectral modeling. SHOT, NRC, and AaD represent feature-space SFDA baselines, while MAPU, TemSR, and CE-SFDA are time-series-specific alternatives. SAFA differs by performing signal-level adaptation with frequency-domain operations and by restricting trainable parameters to the spectral adapter [2606.23120].

The terminology of temporal-spectral alignment and frequency adaptation also appears in adjacent literatures, but in different technical forms. In time-series forecasting dataset distillation, DDTime introduces a temporal-spectral loss that combines temporal fidelity with FFT-based spectral consistency and uses a trade-off parameter \(\alpha\) to balance them [2511.16715]. In fine-grained video understanding, Frame2Freq applies FFT or STFT along time and learns frequency-band specific embeddings in adapters for pretrained vision backbones [2602.18977]. In sound event detection, temporal attention pooling combined with frequency dynamic convolution couples temporal selection with frequency-adaptive feature extraction [2504.12670]. In EEG visual decoding, STAMBRIDGE uses amplitude-derived soft channel weighting and multi-scale temporal convolutions rather than explicit spectral reconstruction [2605.23137]. In forward-backward representations for reinforcement learning, temporal abstraction is analyzed as a low-pass spectral mechanism that suppresses high-frequency components [2603.20103]. These works suggest that temporal-spectral reasoning is a broader methodological trend, whereas the term **SAFA** in the strict sense refers to the source-free time-series domain adaptation method of [2606.23120].

Several limitations are explicit. SAFA is designed for **single-source SFDA** and does not explore multi-source extensions. Its spectral processing uses **global FFT**, so it does not explicitly model time-localized frequency changes such as those targeted by STFT or wavelets. It assumes a **shared label space**, and therefore does not address label shift, open-set adaptation, or universal adaptation. The source model is frozen, which prevents forgetting but may restrict performance when the source model is poorly calibrated or mis-specified for the target [2606.23120].

A common overgeneralization is to treat SAFA as a universal time-frequency alignment framework. The paper makes a narrower claim: it is a source-free adaptation method for time-series classification in which temporal masking and imputation provide temporal robustness, FAL provides explicit amplitude and phase adaptation, and TOV constrains spectral modification so that temporal structure remains reconstructible under the source-domain manifold [2606.23120]. A plausible implication, also reflected in the paper’s stated future directions, is that more expressive spectral modeling, local time-frequency transforms, multi-source variants, and extensions to audio, EEG, or other sensor modalities are natural next steps rather than completed components of the present method.

Source: https://www.emergentmind.com/topics/temporal-spectral-alignment-with-frequency-adaptation-safa