NSSDNResult.decompose#

NSSDNResult.decompose(endog=None, *, exog=None, time=None, scaled=False)[source]#

Every path of the decomposition, for the fitted sample or a new one.

Parameters:
  • endog (ArrayLike | None) – A series to run the trained network over under teacher forcing; None returns the fitted sample’s paths.

  • exog (ArrayLike | None) – Covariates for endog; required when the fit used them.

  • time (ArrayLike | None) – Grid for endog.

  • scaled (bool) – Return the paths in training units (the scale the paper’s figures are drawn in) rather than on the original scale.

Return type:

dict[str, NDArray[double]]

Returns:

Arrays keyed observed, emission, trend, oscillation, amplitude_raw, amplitude, effective_amplitude, frequency, phase, phase_offset, gate, components, state, each with r rows.

Example

The paper’s trend figure is on the training scale:

>>> import numpy as np
>>> y = np.sin(0.2 * np.arange(120.0)) + 5.0
>>> res = NSSDN(y, k=2, state_dim=8, schedule=(Stage(1e-2, 20),), seed=0).fit()
>>> paths = res.decompose(scaled=True)
>>> bool(paths["trend"].max() <= 1.0 + 1e-6), paths["trend"].shape
(True, (120,))