_mixins#

ns_sdn.engine._internals._mixins = <module 'ns_sdn.engine._internals._mixins' from '/home/runner/work/ns-sdn/ns-sdn/src/ns_sdn/engine/_internals/_mixins.py'>[source]#

capabilities a frozen result opts into.

Every class declares __slots__ = () and no fields. A mixin annotates the attributes it reads and the concrete result declares them, which is what lets several compose onto one slotted dataclass. The surface and the names match cultivars’ mixins so a result from this package reads the same way to a user of that one.

Three capabilities: rendering (_SummaryMixin, which turns a _summary_table into summary(), repr, str and the notebook display), frame interop (_SeriesMixin, to_dict and to_pandas over the aligned per-observation outputs), and criterion-named comparison (_ComparisonMixin, the information criteria and compare).

Example

>>> import numpy as np
>>> from ns_sdn.spectral_decomposition import NSSDN, Stage
>>> y = np.sin(0.3 * np.arange(80.0))
>>> res = NSSDN(y, k=1, state_dim=4, schedule=(Stage(1e-2, 5),), seed=0).fit()
>>> [m.__name__ for m in type(res).__mro__ if m.__name__.endswith("Mixin")]
['_SummaryMixin', '_SeriesMixin', '_ComparisonMixin']
>>> res.summary().title, res.to_dict()["observed"].shape, res.aic > res.llf
('NSSDN(k=1) Results', (80,), True)
Type:

Behavior mixins