pyphi.estimate.SubstratePosterior#
- class pyphi.estimate.SubstratePosterior(alpha_on, alpha_off, regime, prior, coverage, node_labels, provenance)[source]#
Bases:
SerializablePosterior distribution over substrates given observed transitions.
Each cell of the state-by-node TPM carries an independent Beta posterior: cell
(s, i)isBeta(alpha_on[s, i], alpha_off[s, i])overp(unit i is ON at t+1 | current state s). Rows follow the little-endian state order.Draw concrete substrates with
sample(); every existing PyPhi computation applies to the samples unchanged.- Variables:
alpha_on (numpy.ndarray[tuple[Any, ...], numpy.dtype[numpy.float64]]) – Beta
aparameters, shape(2**n, n).alpha_off (numpy.ndarray[tuple[Any, ...], numpy.dtype[numpy.float64]]) – Beta
bparameters, shape(2**n, n).regime (str) – The caller’s assertion about how the data was produced (
"perturbational"or"observational").prior (float) – The symmetric Beta prior pseudocount added to every cell.
coverage (pyphi.estimate.CoverageReport) – Per-state observation counts (see
CoverageReport).node_labels (collections.abc.Sequence[str] | None) – Optional labels passed through to sampled substrates.
provenance (pyphi.provenance.Provenance) – Environment record captured at estimation time.
- Parameters:
- sample(*, seed=None, rng=None)[source]#
Draw one substrate from the posterior.
Every TPM cell is drawn independently from its Beta posterior; exactly one of
seedorrngmust be given.
- mean_substrate()[source]#
The posterior-mean substrate: every TPM cell at its Beta mean.
A reference point, not an estimator: φₛ of the mean substrate conflates epistemic uncertainty with the substrate’s own indeterminism (see the module docstring), so it must not be reported as an estimate of φₛ. Its role is to anchor reference computations such as the selection-margin screen in
phi_posterior().- Return type:
- edge_probability(*, n_samples, seed, threshold)[source]#
Graded posterior probability of a causal edge between each unit pair.
Entry
(a, b)is the fraction of posterior samples in which unitb’s estimated conditional varies by more thanthresholdalong input axisa— that is, the maximum absolute difference inp(b = ON | current)between any two current states differing only in unitaexceedsthreshold. This is the graded analogue of a connectivity matrix: an edgea -> bis present to the extent the data makesbdepend ona.The exact-equality oracle
FactoredTPM.infer_cm()cannot serve here: on any continuously-estimated TPM every factor varies along every axis by sampling noise, so it saturates to fully connected. This method replaces that oracle for estimated substrates by asking how much a factor varies, at a caller-chosen scale.thresholdhas no default: the scale below which a dependence is treated as absent is a modeling choice the caller must make.- Parameters:
- Returns:
An
(n, n)array of edge-firing fractions in[0, 1].- Return type: