ns_sdn.summary#
The reporting surface: the records every fitted result renders itself through.
summary() on a result does not format anything; it returns a
SummaryTable, a record that renders on demand as fixed-width
text (print, str, the bare repr), as HTML in a notebook
(_repr_html_) or as a pandas.DataFrame (to_pandas).
InformationCriteria is the record behind every
information_criteria property, the triple
for a log-likelihood \(\ell\), \(p\) parameters and an effective
sample of \(m\) observations. Both are defined once in _core and
bound to this module so pickles, annotations, and the API reference name
them here.
Holding the structure rather than the string is what lets the same
summary carry its notes into every rendering: a table that says
“compare against a random walk before reading these as skill” says it in
the notebook, in the terminal and in the frame’s attrs alike.
See also
ns_sdn.spectral_decomposition.NSSDNResult.summary()andns_sdn.spectral_state.SpectralState.summary()– the two producers of aSummaryTable.ns_sdn.spectral_decomposition.NSSDNResult.compare()– a comparison table across results by one criterion.
Example
>>> from ns_sdn.summary import SummaryTable
>>> table = SummaryTable(title="T", metadata=(("a", "1"),), notes=("n",))
>>> table.to_text().splitlines()[-1], type(table).__module__
('n', 'ns_sdn.summary')
The criteria record is a named tuple with a constructor from the likelihood:
>>> from ns_sdn.summary import InformationCriteria
>>> crit = InformationCriteria.from_likelihood(-100.0, 200, 3)
>>> round(crit.aic, 1), round(crit.bic, 2), crit._fields
(206.0, 215.89, ('aic', 'bic', 'hqic'))
Classes#
Model-selection criteria computed from a fitted log-likelihood. |
|
A rendered-on-demand estimation summary. |