pyphi.actual.Transition#

class pyphi.actual.Transition(substrate, before_state, after_state, cause_indices, effect_indices, *, partition=None, noise_background=False)[source]#

Bases: Serializable

A state transition over a substrate, holding two TransitionSystem views.

Implements the actual-causation framework of Albantakis, Marshall, Hoel, and Tononi (2019). The cause and effect analyses live in TransitionSystem instances accessed via cause_system and effect_system, keyed by Direction in system.

Parameters:
  • substrate (Substrate) – The substrate the transition is defined over.

  • before_state (tuple[int]) – The state of the substrate at time t-1.

  • after_state (tuple[int]) – The state of the substrate at time t.

  • cause_indices (tuple[int] or tuple[str]) – Indices (or labels) of nodes in the cause system.

  • effect_indices (tuple[int] or tuple[str]) – Indices (or labels) of nodes in the effect system.

  • partition (DirectedBipartition, optional) – The partition applied to this transition. Defaults to a NullCut over the union of cause and effect indices.

  • noise_background (bool, optional) – If True, background conditions are noised instead of frozen.

Raises:

TransitionUnreachableError – If the effect occurrence has zero probability given the before state, violating the Realization principle of Albantakis et al. (2019), Section 2.4: p(v_t | v_{t−1}) > 0. The check applies the transition’s own background semantics (frozen, or noised when noise_background is True) and runs only for unpartitioned construction; a transition built with an explicit partition is a derived copy of an already-validated transition.

apply_partition(partition)[source]#

Return a copy of this transition with partition applied.

Parameters:

partition (DirectedBipartition) – The partition to apply; its severed connections are removed from both the cause and the effect system.

Returns:

Transition – A new transition, equal to this one except for its partition.

Return type:

Transition

cause_repertoire(mechanism, purview)[source]#

Return the cause repertoire.

effect_repertoire(mechanism, purview)[source]#

Return the effect repertoire.

unconstrained_cause_repertoire(purview)[source]#

Return the unconstrained cause repertoire of the occurrence.

unconstrained_effect_repertoire(purview)[source]#

Return the unconstrained effect repertoire of the occurrence.

repertoire(direction, mechanism, purview)[source]#

Return the cause or effect repertoire for the given direction.

Parameters:
  • direction (Direction) – The temporal direction, selecting the cause or effect repertoire.

  • mechanism (tuple[int]) – The mechanism to condition on.

  • purview (tuple[int]) – The purview to compute the repertoire over.

Raises:

ValueError – If purview is not a subset of the purview indices, or mechanism is not a subset of the mechanism indices, for the given direction.

state_probability(direction, repertoire, purview)[source]#

Compute the probability of the purview in its current state given the repertoire.

Collapses the dimensions of the repertoire that correspond to the purview nodes onto their state. All other dimensions are already singleton and thus receive 0 as the conditioning index.

Parameters:
  • direction (Direction) – The temporal direction (CAUSE or EFFECT).

  • repertoire (numpy.ndarray) – The repertoire array to index into.

  • purview (tuple[int]) – The purview nodes.

Returns:

float – A single probability.

probability(direction, mechanism, purview)[source]#

Probability that the purview is in its current state given the state of the mechanism.

unconstrained_probability(direction, purview)[source]#

Unconstrained probability of the purview.

purview_state(direction)[source]#

The state of the purview when we are computing coefficients in direction.

For example, if we are computing the cause coefficient of a mechanism in after_state, the direction is CAUSE and the purview_state is before_state.

mechanism_state(direction)[source]#

The state of the mechanism when computing coefficients in direction.

mechanism_indices(direction)[source]#

The indices of nodes in the mechanism system.

purview_indices(direction)[source]#

The indices of nodes in the purview system.

cause_ratio(mechanism, purview)[source]#

The cause ratio of the purview given mechanism.

Always evaluated with PMI (pointwise mutual information), per the 2019 Albantakis et al. formalism, independent of config.formalism.actual_causation.alpha_measure.

effect_ratio(mechanism, purview)[source]#

The effect ratio of the purview given mechanism.

Always evaluated with PMI (pointwise mutual information), per the 2019 Albantakis et al. formalism, independent of config.formalism.actual_causation.alpha_measure.

partitioned_repertoire(direction, partition, *, partitioned_repertoire_scheme=None)[source]#

Compute the repertoire over the partition in the given direction.

partitioned_probability(direction, partition, *, partitioned_repertoire_scheme=None)[source]#

Compute the probability of the mechanism over the purview in the partition.

find_mip(direction, mechanism, purview, *, allow_neg=False)[source]#

Find the ratio minimum information partition for a mechanism over a purview.

Dispatches through the active actual-causation formalism (config.formalism.actual_causation.version).

potential_purviews(direction, mechanism, purviews=None)[source]#

Return all purviews that could belong to the maximally irreducible cause (MaximallyIrreducibleCause) or effect (MaximallyIrreducibleEffect).

Filters out trivially reducible purviews.

Parameters:
  • direction (Direction) – Either CAUSE or EFFECT.

  • mechanism (tuple[int]) – The mechanism of interest.

  • purviews (tuple[int], optional) – Subset of purviews to restrict the search to.

Return the maximally irreducible cause or effect ratio for a mechanism.

Dispatches through the active actual-causation formalism (config.formalism.actual_causation.version).

find_actual_cause(mechanism, purviews=None, *, allow_neg=False)[source]#

Return the actual cause of a mechanism.

find_actual_effect(mechanism, purviews=None, *, allow_neg=False)[source]#

Return the actual effect of a mechanism.

find_mice(*args, **kwargs)[source]#

Alias for find_causal_link().