SpectralState.to_dict#

SpectralState.to_dict()[source]#

The scalar coordinates as aligned arrays of nobs rows.

The three velocities are padded with nan in row 0 so every column has nobs entries and row \(i\) of a velocity is the motion into row \(i\). n_active is the number of active components per row as a float.

Return type:

dict[str, NDArray[double]]

Returns:

Arrays keyed centroid, dispersion, entropy, effective_count, participation_ratio, velocity, velocity_frequency, velocity_mass, n_active.

Example

>>> import numpy as np
>>> from ns_sdn.spectral_decomposition import NSSDN, Stage
>>> y = np.sin(0.3 * np.arange(160.0))
>>> res = NSSDN(y, k=2, state_dim=8, schedule=(Stage(1e-2, 20),), seed=0).fit()
>>> out = res.spectral_state().to_dict()
>>> len(out), "n_active" in out, bool(np.isnan(out["velocity"][0]))
(9, True, True)
>>> out["velocity"].shape, bool(out["n_active"].max() <= 2.0)
((160,), True)