Skip to content

v0.0.23

Latest

Choose a tag to compare

@wwhenxuan wwhenxuan released this 17 Sep 03:56
· 4 commits to main since this release

What's new

This release ports the core of ForeCA (Goerg, JMLR 2013) into s2generator.utils.forecastability: spectral entropy, the Omega forecastability score, multivariate spectra, ZCA whitening, Slow Feature Analysis, and EM-based forecastable components. utils is also split into subpackages, and examples are now Sphinx-Gallery .py scripts.

Forecastability (ForeCA)

Series are (T,) or (T, K) with time on axis 0.

  • omega / spectral_entropy — Shannon entropy of the normalized spectrum, reported as Omega in [0, 100] (white noise low, sinusoid high)
  • mvspectrum — univariate periodogram / Welch, or Hermitian CSD tensors for multivariate series
  • whiten — ZCA whitening
  • SlowFeatureAnalysis — slowest-first features from cov(diff(U)) after whitening
  • ForeCA — EM that minimises spectral entropy; successive components are orthogonal in the whitened space
  • Plots: plot_omega, plot_spectrum, plot_foreca, plot_sfa

Examples: examples/tools/omega_spectral_entropy.py, examples/tools/foreca_components.py, examples/tools/sfa_vs_foreca.py

from s2generator.utils import ForeCA, omega

om = omega(X, method="welch")          # (K,) scores in [0, 100]
model = ForeCA(n_comp=2, n_starts=4, random_state=0)
scores = model.fit_transform(X)        # (T, n_comp)
print(model.omega)                     # descending Omega of each ForeC

Utils layout

Helpers now live under distance, correlation, decomposition, smooth, data, tools, visualization, and forecastability. from s2generator.utils import … still works.

Docs and examples

Notebooks under examples/ are replaced by Sphinx-Gallery scripts; docs use the PyData Sphinx theme.

Install

pip install s2generator==0.0.23

Full Changelog: v0.0.22...v0.0.23