Skip to content

Spectral Features

Spectral analysis decomposes signals into frequency components using the Fast Fourier Transform (FFT).

Spectral Centroid

Feature Names: spectral_centroid_pre, spectral_centroid_post, spectral_centroid_diff

\[ SC = \frac{\sum_k f(k) \cdot |X(k)|^2}{\sum_k |X(k)|^2} \]

where: - X(k): FFT at frequency bin k - f(k): Frequency of bin k

Interpretation

  • "Center of mass" of the spectrum
  • Higher SC: More high-frequency content
  • Lower SC: More low-frequency content

Why Useful

Changes in spectral centroid indicate shifts in dominant frequency content. A series might shift from slow oscillations to rapid fluctuations.

Used by: knn_spectral_fft, xgb_selective_spectral, meta_stacking_7models


Spectral Bandwidth

Feature Names: spectral_bandwidth_pre, spectral_bandwidth_post, spectral_bandwidth_diff

\[ SB = \sqrt{\frac{\sum_k (f(k) - SC)^2 \cdot |X(k)|^2}{\sum_k |X(k)|^2}} \]

Interpretation

  • Weighted standard deviation around spectral centroid
  • Higher SB: Broad frequency content
  • Lower SB: Narrow, focused frequency content

Used by: knn_spectral_fft


Spectral Flux

Feature Name: spectral_flux

\[ SF = \sum_k (|X_{\text{post}}(k)| - |X_{\text{pre}}(k)|)^2 \]

Interpretation

  • Sum of squared differences between spectral magnitudes
  • SF = 0: Identical spectra
  • Larger SF: More spectral change

Used by: knn_spectral_fft


Spectral Entropy

Feature Name: spectral_entropy_diff

\[ H = -\sum_k p_k \cdot \log_2(p_k) \]

where: $$ p_k = \frac{|X(k)|^2}{\sum_j |X(j)|^2} $$

Interpretation

Value Meaning
High entropy Noise-like, unpredictable (flat spectrum)
Low entropy Periodic, structured (dominant frequency)

Why Useful

Changes in spectral entropy indicate shifts between structured (periodic) and unstructured (random) behavior.

Used by: knn_spectral_fft


Non-Uniform FFT

For irregular time series, the Non-Uniform Fast Fourier Transform (NUFFT) can be applied. This handles data with non-uniform sampling.

Reference: Song, J. H., Lopez de Prado, M., Simon, H., & Wu, K. (2014). "Exploring Irregular Time Series Through Non-Uniform Fast Fourier Transform."