actual

Methods for computing actual causation of subsystems and mechanisms.

pyphi.actual.log2(x)

Rounded version of log2.

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

A state transition between two sets of nodes in a network.

A Transition is implemented with 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 transition.

Note

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

to_json()

Return a JSON-serializable representation.

apply_cut(cut)

Return a cut version of this transition.

cause_repertoire(mechanism, purview)

Return the cause repertoire.

effect_repertoire(mechanism, purview)

Return the effect repertoire.

unconstrained_cause_repertoire(purview)

Return the unconstrained cause repertoire of the occurence.

unconstrained_effect_repertoire(purview)

Return the unconstrained effect repertoire of the occurence.

repertoire(direction, mechanism, purview)

Returns the cause or effect repertoire function based on a direction.

Parameters:direction (str) – The temporal direction, specifiying the cause or effect repertoire.
state_probability(direction, repertoire, purview)

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 dimension are already singular and thus receive 0 as the conditioning index.

Returns a single probabilty.

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

mechanism_state(direction)

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

mechanism_indices(direction)

The indices of nodes in the mechanism system.

cause_ratio(mechanism, purview)

The cause ratio of the purview given mechanism.

effect_ratio(mechanism, purview)

The effect ratio of the purview given mechanism.

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, allow_neg=False)

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

Parameters:
  • direction (str) – PAST or FUTURE
  • mechanism (tuple[int]) – A mechanism.
  • purview (tuple[int]) – A purview.
Keyword Arguments:
 

allow_neg (boolean) – If true, alpha is allowed to be negative. Otherwise, negative values of alpha will be treated as if they were 0.

Returns:

The found MIP.

Return type:

AcMip

potential_purviews(direction, mechanism, purviews=False)

Return all purviews that could belong to the core cause/effect.

Filters out trivially-reducible purviews.

Parameters:
  • direction (str) – Either PAST or FUTURE.
  • mechanism (tuple[int]) – The mechanism of interest.
Keyword Argss:
purviews (tuple[int]): Optional subset of purviews of interest.

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

Parameters:
  • direction (str) – The temporal direction, specifying cause or effect.
  • mechanism (tuple[int]) – The mechanism to be tested for irreducibility.
Keyword Arguments:
 

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.

Returns:

The maximally-irreducible actual cause or effect.

Return type:

CausalLink

find_actual_cause(mechanism, purviews=False)

Return the actual cause of a mechanism.

find_actual_effect(mechanism, purviews=False)

Return the actual effect of a mechanism.

find_mice(*args, **kwargs)

Backwards-compatible alias for find_causal_link().

pyphi.actual.directed_account(transition, direction, mechanisms=False, purviews=False, allow_neg=False)

Return the set of all CausalLink of the specified direction.

pyphi.actual.account(transition, direction=<Direction.BIDIRECTIONAL: 2>)

Return the set of all causal links for a Transition.

Parameters:transition (Transition) – The transition of interest.
Keyword Arguments:
 direction (Direction) – By default the account contains actual causes and actual effects.
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
Returns:

The distance between the two accounts.

Return type:

float

pyphi.actual.big_acmip(transition, direction=<Direction.BIDIRECTIONAL: 2>)

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

Parameters:transition (Transition) – The candidate system.
Returns:A nested structure containing all the data from the intermediate calculations. The top level contains the basic MIP information for the given subsystem.
Return type:AcBigMip
class pyphi.actual.FindBigAcMip(iterable, *context)

Computation engine for AC BigMips.

description = 'Evaluating AC cuts'
empty_result(transition, direction, unpartitioned_account)
static compute(cut, transition, direction, unpartitioned_account)
process_result(new_mip, min_mip)
pyphi.actual.transitions(network, before_state, after_state)

Return a generator of all possible transitions of a network.

pyphi.actual.nexus(network, before_state, after_state, direction=<Direction.BIDIRECTIONAL: 2>)

Return a tuple of all irreducible nexus of the network.

pyphi.actual.causal_nexus(network, before_state, after_state, direction=<Direction.BIDIRECTIONAL: 2>)

Return the causal nexus of the network.

pyphi.actual.nice_true_constellation(tc)

Format a 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:
  • 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.
Keyword Arguments:
 
  • indices (tuple[int]) – The indices of the main complex.
  • main_complex (AcBigMip) – The main complex. If main_complex is given then indices is ignored.
Returns:

List of true events in the main complex.

Return type:

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:
  • 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.
Keyword Arguments:
 
  • indices (tuple[int]) – The indices of the main complex.
  • main_complex (AcBigMip) – The main complex. If main_complex is given then indices is ignored.
Returns:

List of extrinsic events in the main complex.

Return type:

tuple(actions)