---
title: 'Times2D Framework: FSDH Derivative Heatmaps'
url: https://www.emergentmind.com/topics/times2d-framework
type: topic
---

# Times2D Framework: FSDH Derivative Heatmaps

First and Second Derivative Heatmaps (FSDH) are a structured approach for extracting and representing sharp local transitions and turning points in multivariate time series data by leveraging pointwise discrete temporal derivatives. Developed as a core module within the Times2D forecasting framework, FSDH translates 1D sequential data into a 2D tensor format, enabling the use of 2D convolutional architectures for robust feature extraction. This representation addresses the limitations of strictly periodic or spectral decomposition by providing complementary edge-like and inflection-point information crucial for forecasting under nonstationary and highly fluctuating conditions [2504.00118].

## 1. Mathematical Construction

Given a batch tensor $X_{1D}\in\mathbb{R}^{B\times S\times N}$, where $B$ is the batch size, $S$ the length of the time series, and $N$ the feature dimension (channels), the FSDH module computes the following:

- **First Derivative**:  
  \[
  D_1(t) = X_{1D}(t+1) - X_{1D}(t),\quad  D_1(0) = \mathbf{0}, \quad t=0,\ldots, S-2
  \]
  yielding $D_1 \in \mathbb{R}^{B \times S \times N}$.

- **Second Derivative**:  
  \[
  D_2(t) = D_1(t+1) - D_1(t),\quad  D_2(0) = \mathbf{0}, \quad t=0,\ldots, S-2
  \]
  resulting in $D_2 \in \mathbb{R}^{B \times S \times N}$.

Normalization is performed along the time axis to ensure scale-robustness, either by absolute maximum scaling:
\[
\widetilde D_i(t) = \frac{D_i(t)}{\max_{t'}|D_i(t')| + \varepsilon}
\]
or by z-score normalization:
\[
\widetilde D_i(t) = \frac{D_i(t) - \mu_i}{\sigma_i},\quad \mu_i = \frac{1}{S}\sum_{t}D_i(t),\quad \sigma_i^2 = \frac{1}{S}\sum_{t}(D_i(t) - \mu_i)^2
\]

## 2. Heatmap Tensorization and Convolutional Encoding

The normalized derivatives are stacked along a new "derivative" axis to form the 2D heatmap tensor:
\[
H_{2D}(t,d) = 
\begin{cases}
\widetilde D_1(t) & d=1\\
\widetilde D_2(t) & d=2
\end{cases}
\]
which results in $H_{2D}\in\mathbb{R}^{B \times 2 \times S \times N}$.

This tensor serves as input to a shallow 2D convolutional network:
\[
\widehat H_{2D} = \mathrm{Conv2D}(H_{2D}),\quad \widehat H_{2D}\in\mathbb{R}^{B\times C'\times S\times N}
\]
where typical parameters are a kernel of size $3\times 3$, stride 1, padding 1, 2–3 layers, with ReLU activation and BatchNorm after each convolution. The output is then aggregated (e.g., weighted sum or linear projection) and resized via a head module to $[B, P, N]$ for downstream forecasting.

## 3. Interpretative Role in Time Series Forecasting

The FSDH representation enables explicit modeling of sharp local dynamics:

- The first derivative $D_1$ highlights regions of acute increases or decreases in the series, corresponding to edges or sudden events.
- The second derivative $D_2$ identifies turning points and inflection regions, as sign changes in $D_2$ correlate with local maxima and minima.

Combined, these two maps encode local information about non-stationarity and irregular fluctuations. This is critical for reliably forecasting series with abrupt regime shifts, spikes, or drops, supplementing global periodic summaries.

## 4. Integration Within the Times2D Framework

The FSDH module is integrated into Times2D alongside the Periodic Decomposition Block (PDB). Both modules independently produce $[B, P, N]$ outputs:

- FSDH: $\widehat X_{1D}^{\rm FSDH}$
- PDB: $\widehat X_{1D}^{\rm PDB}$

These are fused within the Aggregation Forecasting Block (AFB) via elementwise summation:
\[
\widehat X_{1D} = \widehat X_{1D}^{\rm PDB} + \widehat X_{1D}^{\rm FSDH}
\]
Alternatively, learnable scalar gating factors $\alpha \in (0,1)$ may reweight the modules:
\[
\widehat X_{1D} = \alpha\,\widehat X_{1D}^{\rm PDB} + (1-\alpha)\,\widehat X_{1D}^{\rm FSDH}
\]
This architecture supports modular, interpretable, and effective fusion of multiscale periodic structure and local temporal change information [2504.00118].

## 5. Implementation Details and Hyperparameterization

The FSDH configurations validated in experimental studies include:

| Parameter              | Typical Value(s)              | Notes                                          |
|------------------------|-------------------------------|------------------------------------------------|
| Input size ($S$)       | 96 – 1440                     | Series segment length                          |
| Convolutional Layers   | 2 or 3                        | Conv$\to$ReLU$\to$BatchNorm, 3×3 kernels       |
| Channels (per layer)   | [32 → 64 → 32] (example)      | First layer: 2 input, last layer: $C'$ output  |
| Head                   | 1×1 conv or linear projection | For mapping $C'\times S\times N \to S\times N$ |
| Loss                   | MSE or MAE on $\widehat X_{1D}$| Joint optimization across Times2D modules      |

Both convolutional and head parameters, as well as any gating scalars, are trained end-to-end with the rest of the Times2D architecture.

## 6. Significance and Empirical Performance

FSDH provides a lightweight yet effective 2D "image" of time series derivatives, enabling convolutional architectures to efficiently extract edge-like (first derivative) and corner-like (second derivative) features. Empirical results within the Times2D model demonstrate that, when FSDH is fused with spectral features from the PDB, the combined representation achieves state-of-the-art results in both short-term and long-term multivariate time series forecasting across large-scale benchmarks. This suggests that explicitly capturing local nonstationary transitions, in addition to periodic structure, is crucial for high-fidelity predictive modeling in complex temporal domains [2504.00118].

Source: https://www.emergentmind.com/topics/times2d-framework