DescriptionLength#

class hybrid_aif.DescriptionLength[source]#

Bases: NamedTuple

A model’s length, or a model’s and a trace’s together, in nats.

The model part is structure plus parameters; the data part is data. A black box the System holds (an external process declared by its ports alone) is priced by its ports, which are declared structure: its out-ports are emissions of the graph code, each with its size code, and an in-port nothing drives a control node. Its inside, the kernel between the ports, is listed under black_box:<component> (black_box for a System that is one) with every link unscored: its four pairs are in unscored, nothing of it is in structure, parameters or total, and exact is False, since the total leaves the inside out. Its floor would be a code length for its program, which is not built (description-length.md D3). A System that states nothing but black-box ports has no graph record: its totals are its ports’ codes.

structure: float#

The graph and family codes, in nats.

parameters: float#

The prior and posterior codes, in nats.

total: float#

The model part plus the data part where there is one.

per_address: Mapping[str, Links]#

The links behind the model part, by address.

exact: bool#

Whether every address’s links are exact.

unscored: tuple[tuple[str, str], ...]#

The (address, link) pairs reported None.

data: float | None#

The data part: the trace’s free energy summed along a replay; None for the model alone.

learned: tuple[str, ...]#

The addresses a replay learned, whose family links the data part pays for instead (D6).

data_exact: bool | None#

Whether the data part is the exact free energy of the tick’s posterior: False where a neural likelihood, an MLPConditional transition or a NonlinearGaussianTransition enters it, each read through its linearisation, so the data part is the free energy of the linearised model; None without a replay.

property model: float#

The model part: structure + parameters.

property bits: tuple[float, float, float]#

(structure, parameters, total) in bits; total includes the data part where there is one.

static __new__(
_cls,
structure,
parameters,
total,
per_address,
exact,
unscored,
data=None,
learned=(),
data_exact=None,
)#

Create new instance of DescriptionLength(structure, parameters, total, per_address, exact, unscored, data, learned, data_exact)