subsystem

Represents a candidate system for \(\varphi\) and \(\Phi\) evaluation.

class pyphi.subsystem.Subsystem(network, state, node_indices, cut=None, mice_cache=None, repertoire_cache=None)

A set of nodes in a network.

Parameters:
  • network (Network) – The network the subsystem belongs to.
  • state (tuple(int) – The state of the network.
  • node_indices (tuple(int) – A sequence of indices of the nodes in this subsystem.
Keyword Arguments:
 

cut (Cut) – The unidirectional Cut to apply to this subsystem.

nodes

list(Node – A list of nodes in the subsystem.

node_indices

tuple(int – The indices of the nodes in the subsystem.

size

int – The number of nodes in the subsystem.

network

Network – The network the subsystem belongs to.

state

tuple(int – The state of the subsystem’s network. state[i] gives the state of node \(i\).

proper_state

tuple(int – The state of the subsystem. proper_state[i] gives the \(i^{\textrm{th}}\) node in the subsystem. Note that this is not the state of node \(i\).

cut

Cut – The cut that has been applied to this subsystem.

connectivity_matrix

np.array – The connectivity matrix after applying the cut.

cut_matrix

np.array – A matrix of connections which have been severed by the cut.

perturb_vector

np.array – The vector of perturbation probabilities for each node.

null_cut

Cut – The cut object representing no cut.

tpm

np.array – The TPM conditioned on the state of the external nodes.

Construct a Subsystem.

state

The state of the Network this Subsystem belongs to.

proper_state

The state of the nodes in this Subsystem.

size

The size of this Subsystem.

is_cut()

Return whether this Subsystem has a cut applied to it.

repertoire_cache_info()

Report repertoire cache statistics.

__repr__()

Return a representation of this Subsystem.

__str__()

Return this Subsystem as a string.

__eq__(other)

Return whether this Subsystem is equal to the other object.

Two Subsystems are equal if their sets of nodes, networks, and cuts are equal.

__bool__()

Return false if the Subsystem has no nodes, true otherwise.

__ne__(other)

Return whether this Subsystem is not equal to the other object.

__ge__(other)

Return whether this Subsystem >= the other object.

__le__(other)

Return whether this Subsystem <= the other object.

__gt__(other)

Return whether this Subsystem > the other object.

__lt__(other)

Return whether this Subsystem < the other object.

__len__()

Return the number of nodes in this Subsystem.

__hash__()

Return the hash value of this Subsystem.

to_json()

Return this Subsystem as a JSON object.

indices2nodes(indices)

Return nodes for these indices.

Parameters:indices (iterable(int) –
Returns:nodes
The Node objects corresponding to
these indices.
Return type:tuple(Node
Raises:ValueError – If requested indices are not in the subsystem.
cause_repertoire(mechanism, purview)

Return the cause repertoire of a mechanism over a purview.

Parameters:
  • mechanism (tuple(int) – The mechanism for which to calculate the cause repertoire.
  • purview (tuple(int) – The purview over which to calculate the cause repertoire.
Returns:

cause_repertoire

The cause repertoire of the

mechanism over the purview.

Return type:

np.ndarray

Note

The returned repertoire is a distribution over the nodes in the purview, not the whole network. This is because we never actually need to compare proper cause/effect repertoires, which are distributions over the whole network; we need only compare the purview-repertoires with each other, since cut vs. whole comparisons are only ever done over the same purview.

effect_repertoire(mechanism, purview)

Return the effect repertoire of a mechanism over a purview.

Parameters:
  • mechanism (tuple(int) – The mechanism for which to calculate the effect repertoire.
  • purview (tuple(int) – The purview over which to calculate the effect repertoire.
Returns:

effect_repertoire

The effect repertoire of the

mechanism over the purview.

Return type:

np.ndarray

Note

The returned repertoire is a distribution over the nodes in the purview, not the whole network. This is because we never actually need to compare proper cause/effect repertoires, which are distributions over the whole network; we need only compare the purview-repertoires with each other, since cut vs. whole comparisons are only ever done over the same purview.

unconstrained_cause_repertoire(purview)

Return the unconstrained cause repertoire for a purview.

This is just the cause repertoire in the absence of any mechanism.

unconstrained_effect_repertoire(purview)

Return the unconstrained effect repertoire for a purview.

This is just the effect repertoire in the absence of any mechanism.

expand_repertoire(direction, purview, repertoire, new_purview=None)

Expand a partial repertoire over a purview to a distribution over a new state space.

Parameters:
  • direction (str) – Either DIRECTIONS[PAST] or DIRECTIONS[FUTURE].
  • purview (tuple(int) – The purview over which the repertoire was calculated.
  • repertoire (np.ndarray) – A repertoire computed over purview.
Keyword Arguments:
 

new_purview (tuple(int) – The purview to expand the repertoire over. Defaults to the entire subsystem.

Returns:

The expanded repertoire.

Return type:

np.ndarray

expand_cause_repertoire(purview, repertoire, new_purview=None)

Expand a partial cause repertoire over a purview to a distribution over the entire subsystem’s state space.

expand_effect_repertoire(purview, repertoire, new_purview=None)

Expand a partial effect repertoire over a purview to a distribution over the entire subsystem’s state space.

cause_info(mechanism, purview)

Return the cause information for a mechanism over a purview.

effect_info(mechanism, purview)

Return the effect information for a mechanism over a purview.

cause_effect_info(mechanism, purview)

Return the cause-effect information for a mechanism over a purview.

This is the minimum of the cause and effect information.

find_mip(direction, mechanism, purview)

Return the minimum information partition for a mechanism over a purview.

Parameters:
  • direction (str) – Either DIRECTIONS[PAST] or DIRECTIONS[FUTURE].
  • mechanism (tuple(int) – The nodes in the mechanism.
  • purview (tuple(int) – The nodes in the purview.
Returns:

mip

The mininum-information partition in one temporal

direction.

Return type:

Mip

mip_past(mechanism, purview)

Return the past minimum information partition.

Alias for find_mip() with direction set to DIRECTIONS[PAST].

mip_future(mechanism, purview)

Return the future minimum information partition.

Alias for find_mip() with direction set to DIRECTIONS[FUTURE].

phi_mip_past(mechanism, purview)

Return the \(\varphi\) of the past minimum information partition.

This is the distance between the unpartitioned cause repertoire and the MIP cause repertoire.

phi_mip_future(mechanism, purview)

Return the \(\varphi\) of the future minimum information partition.

This is the distance between the unpartitioned effect repertoire and the MIP cause repertoire.

phi(mechanism, purview)

Return the \(\varphi\) of a mechanism over a purview.

find_mice(direction, mechanism, purviews=False)

Return the maximally irreducible cause or effect for a mechanism.

Parameters:
  • direction (str) – The temporal direction (DIRECTIONS[PAST] or DIRECTIONS[FUTURE]) 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:

mice – The maximally-irreducible cause or effect.

Return type:

Mice

Note

Strictly speaking, the MICE is a pair of repertoires: the core cause repertoire and core effect repertoire of a mechanism, which are maximally different than the unconstrained cause/effect repertoires (i.e., those that maximize \(\varphi\)). Here, we return only information corresponding to one direction, DIRECTIONS[PAST] or DIRECTIONS[FUTURE], i.e., we return a core cause or core effect, not the pair of them.

core_cause(mechanism, purviews=False)

Return the core cause repertoire of a mechanism.

Alias for find_mice() with direction set to DIRECTIONS[PAST].

core_effect(mechanism, purviews=False)

Return the core effect repertoire of a mechanism.

Alias for find_mice() with direction set to DIRECTIONS[PAST].

phi_max(mechanism)

Return the \(\varphi^{\textrm{max}}\) of a mechanism.

This is the maximum of \(\varphi\) taken over all possible purviews.

null_concept

Return the null concept of this subsystem.

The null concept is a point in concept space identified with the unconstrained cause and effect repertoire of this subsystem.

concept(mechanism, purviews=False, past_purviews=False, future_purviews=False)

Calculate a concept.

See pyphi.compute.concept() for more information.

pyphi.subsystem.mip_bipartitions(mechanism, purview)

Return all \(\varphi\) bipartitions of a mechanism over a purview.

Excludes all bipartitions where one half is entirely empty, e.g:

A [] A []
— X – is not valid, but — X — is.
B [] [] B
Parameters:
  • mechanism (tuple(int) – The mechanism to partition
  • purview (tuple(int) – The purview to partition
Returns:

bipartitions

Where each partition is

bipart[0].mechanism bipart[1].mechanism ——————- X ——————-

bipart[0].purview bipart[1].purview

Return type:

list(tuple((Part, Part

Example

>>> from pyphi.subsystem import mip_bipartitions
>>> mechanism = (0,)
>>> purview = (2, 3)
>>> mip_bipartitions(mechanism, purview)
[(Part(mechanism=(), purview=(2,)), Part(mechanism=(0,), purview=(3,))), (Part(mechanism=(), purview=(3,)), Part(mechanism=(0,), purview=(2,))), (Part(mechanism=(), purview=(2, 3)), Part(mechanism=(0,), purview=()))]