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;Nonereturns the fitted sample’s paths.exog (
ArrayLike|None) – Covariates forendog; required when the fit used them.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:
- Returns:
Arrays keyed
observed, emission, trend, oscillation, amplitude_raw, amplitude, effective_amplitude, frequency, phase, phase_offset, gate, components, state, each withrrows.
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,))