# actual¶

Methods for computing actual causation of subsystems and mechanisms.

class pyphi.actual.Context(network, before_state, after_state, cause_indices, effect_indices, cut=None)

A set of nodes in a network, with state transitions.

A Context contains two Subsystem objects - one representing the system at time $$t-1$$ used to compute effect coefficients, and another representing the system at time $$t$$ which is used to compute cause coefficients. These subsystems are accessed with the effect_system and cause_system attributes, and are mapped to the causal directions via the system attribute.

Parameters: network (Network) – The network the subsystem belongs to. before_state (tuple[int]) – The state of the network at time $$t-1$$. after_state (tuple[int]) – The state of the network at time $$t$$. cause_indices (tuple[int] or tuple[str]) – Indices of nodes in the cause system. (TODO: clarify) effect_indices (tuple[int] or tuple[str]) – Indices of nodes in the effect system. (TODO: clarify)
node_indices

tuple[int] – The indices of the nodes in the system.

network

Network – The network the system belongs to.

before_state

tuple[int] – The state of the network at time $$t-1$$.

after_state

tuple[int] – The state of the network at time $$t$$.

effect_system

Subsystem – The system in before_state used to compute effect repertoires and coefficients.

cause_system

Subsystem – The system in after_state used to compute cause repertoires and coefficients.

cause_system

Subsystem

system

dict – A dictionary mapping causal directions to the system used to compute repertoires in that direction.

cut

ActualCut – The cut that has been applied to this context.

Note

During initialization, both the cause and effect systems are conditioned on the before_state as the background state. After conditioning the effect_system is then properly reset to after_state.

to_json()
apply_cut(cut)

Return a cut version of this context.

cause_repertoire(mechanism, purview)
effect_repertoire(mechanism, purview)
unconstrained_cause_repertoire(purview)
unconstrained_effect_repertoire(purview)
state_probability(direction, repertoire, purview)

The dimensions of the repertoire that correspond to the fixed nodes are collapsed onto their state. All other dimension should be singular already (repertoire size and fixed_nodes need to match), and thus should receive 0 as the conditioning index. A single probability is returned.

probability(direction, mechanism, purview)

Probability that the purview is in it’s current state given the state of the mechanism.

unconstrained_probability(direction, purview)

Unconstrained probability of the purview.

purview_state(direction)

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 isPAST and the purview_state is before_state.

mechanism_state(direction)

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

cause_coefficient(mechanism, purview, norm=True)

Return the cause coefficient for a mechanism in a state over a purview in the actual past state

effect_coefficient(mechanism, purview, norm=True)

Return the effect coefficient for a mechanism in a state over a purview in the actual future state

partitioned_repertoire(direction, partition)

Compute the repertoire over the partition in the given direction.

partitioned_probability(direction, partition)

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

find_mip(direction, mechanism, purview, norm=True, allow_neg=False)

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

Parameters: Keyword Arguments: direction (str) – PAST or FUTURE mechanism (tuple[int]) – A mechanism. purview (tuple[int]) – A purview. norm (boolean) – If true, probabilities will be normalized. allow_neg (boolean) – If true, alpha is allowed to be negative. Otherwise, negative values of alpha will be treated as if they were 0. The found MIP. AcMip
find_occurence(direction, mechanism, purviews=False, norm=True, allow_neg=False)

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

Parameters: Keyword Arguments: direction (str) – The temporal direction, specifying cause or effect. mechanism (tuple[int]) – The mechanism to be tested for irreducibility. purviews (tuple[int]) – Optionally restrict the possible purviews to a subset of the subsystem. This may be useful for _e.g._ finding only concepts that are “about” a certain subset of nodes. The maximally-irreducible actual cause or effect. Occurence

Note

Strictly speaking, the Occurence is a pair of coefficients: the actual cause and actual effect of a mechanism. Here, we return only information corresponding to one direction, PAST or FUTURE, i.e., we return an actual cause or actual effect coefficient, not the pair of them.

find_mice(*args, **kwargs)

Backwards-compatible alias for find_occurence().

pyphi.actual.nice_ac_composition(account)
pyphi.actual.multiple_states_nice_ac_composition(network, transitions, cause_indices, effect_indices, mechanisms=False, purviews=False, norm=True, allow_neg=False)

Print a nice composition for multiple pairs of states.

Parameters: transitions (list(2 state-tuples)) – The first is past the second current. For ‘past’ current belongs to subsystem and past is the second state. Vice versa for “future”
pyphi.actual.directed_account(context, direction, mechanisms=False, purviews=False, norm=True, allow_neg=False)

Return the set of all Occurence of the specified direction.

pyphi.actual.account(context, direction)
pyphi.actual.account_distance(A1, A2)

Return the distance between two accounts. Here that is just the difference in sum(alpha)

Parameters: A1 (Account) – The first account. A2 (Account) – The second account The distance between the two accounts. float
pyphi.actual.big_acmip(context, direction=None)

Return the minimal information partition of a context in a specific direction.

Parameters: context (Context) – The candidate system. A nested structure containing all the data from the intermediate calculations. The top level contains the basic MIP information for the given subsystem. AcBigMip
pyphi.actual.contexts(network, before_state, after_state)

Return a generator of all possible contexts of a network.

pyphi.actual.nexus(network, before_state, after_state, direction=None)

Return a generator for all irreducible nexus of the network. Direction options are past, future, bidirectional.

pyphi.actual.causal_nexus(network, before_state, after_state, direction=None)

Return the causal nexus of the network.

pyphi.actual.nice_true_constellation(true_constellation)
pyphi.actual.events(network, past_state, current_state, future_state, nodes, mechanisms=False)

Find all events (mechanisms with actual causes and actual effects.

pyphi.actual.true_constellation(subsystem, past_state, future_state)

Set of all sets of elements that have true causes and true effects.

Note

Since the true constellation is always about the full system, the background conditions don’t matter and the subsystem should be conditioned on the current state.

pyphi.actual.true_events(network, past_state, current_state, future_state, indices=None, main_complex=None)

Return all mechanisms that have true causes and true effects within the complex.

Parameters: Keyword Arguments: network (Network) – The network to analyze. past_state (tuple[int]) – The state of the network at t - 1. current_state (tuple[int]) – The state of the network at t. future_state (tuple[int]) – The state of the network at t + 1. indices (tuple[int]) – The indices of the main complex. main_complex (AcBigMip) – The main complex. If main_complex is given then indices is ignored. List of true events in the main complex. tuple[Event]
pyphi.actual.extrinsic_events(network, past_state, current_state, future_state, indices=None, main_complex=None)

Set of all mechanisms that are in the main complex but which have true causes and effects within the entire network.

Parameters: Keyword Arguments: network (Network) – The network to analyze. past_state (tuple[int]) – The state of the network at t - 1. current_state (tuple[int]) – The state of the network at t. future_state (tuple[int]) – The state of the network at t + 1. indices (tuple[int]) – The indices of the main complex. main_complex (AcBigMip) – The main complex. If main_complex is given then indices is ignored. List of extrinsic events in the main complex. tuple(actions)