subsystem
¶
Represents a candidate system for \(\varphi\) and \(\Phi\) evaluation.
- class pyphi.subsystem.Subsystem(network, state, nodes=None, cut=None, mice_cache=None, repertoire_cache=None, single_node_repertoire_cache=None, _external_indices=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.
- Keyword Arguments
- tpm¶
The TPM conditioned on the state of the external nodes.
- Type
np.ndarray
- cm¶
The connectivity matrix after applying the cut.
- Type
np.ndarray
- state¶
The state of the network.
- Type
tuple[int]
- node_indices¶
The indices of the nodes in the subsystem.
- Type
tuple[int]
- property proper_state¶
The state of the subsystem.
proper_state[i]
gives the state of the \(i^{\textrm{th}}\) node in the subsystem. Note that this is not the state ofnodes[i]
.- Type
tuple[int]
- property size¶
The number of nodes in the subsystem.
- Type
int
- property is_cut¶
True
if this Subsystem has a cut applied to it.- Type
bool
- property cut_indices¶
The nodes of this subsystem to cut for \(\Phi\) computations.
This was added to support
MacroSubsystem
, which cuts indices other thannode_indices
.- Yields
tuple[int]
- Type
tuple[int]
- property cut_mechanisms¶
The mechanisms that are cut in this system.
- Type
list[tuple[int]]
- property cut_node_labels¶
Labels for the nodes of this system that will be cut.
- Type
NodeLabels
- property tpm_size¶
The number of nodes in the TPM.
- Type
int
- cache_info()¶
Report repertoire cache statistics.
- clear_caches()¶
Clear the mice and repertoire caches.
- __bool__()¶
Return
False
if the Subsystem has no nodes,True
otherwise.
- __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.
- __lt__(other)¶
Return whether this subsystem has fewer nodes than the other.
- __gt__(other)¶
Return whether this subsystem has more nodes than the other.
- __len__()¶
Return the number of nodes in this Subsystem.
- to_json()¶
Return a JSON-serializable representation.
- 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
The cause repertoire of the mechanism over the purview.
- Return type
np.ndarray
Note
The returned repertoire is a distribution over purview node states, not the states of the whole network.
- 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
The effect repertoire of the mechanism over the purview.
- Return type
np.ndarray
Note
The returned repertoire is a distribution over purview node states, not the states of the whole network.
- repertoire(direction, mechanism, purview)¶
Return the cause or effect repertoire based on a direction.
- Parameters
- Returns
The cause or effect repertoire of the mechanism over the purview.
- Return type
np.ndarray
- Raises
ValueError – If
direction
is invalid.
- unconstrained_repertoire(direction, purview)¶
Return the unconstrained cause/effect repertoire over a 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.
- partitioned_repertoire(direction, partition)¶
Compute the repertoire of a partitioned mechanism and purview.
- expand_repertoire(direction, repertoire, new_purview=None)¶
Distribute an effect repertoire over a larger purview.
- Parameters
- Keyword Arguments
new_purview (tuple[int]) – The new purview to expand the repertoire over. If
None
(the default), the new purview is the entire network.- Returns
A distribution over the new purview, where probability is spread out over the new nodes.
- Return type
np.ndarray
- Raises
ValueError – If the expanded purview doesn’t contain the original purview.
- expand_cause_repertoire(repertoire, new_purview=None)¶
Alias for
expand_repertoire()
withdirection
set toCAUSE
.
- expand_effect_repertoire(repertoire, new_purview=None)¶
Alias for
expand_repertoire()
withdirection
set toEFFECT
.
- 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.
- evaluate_partition(direction, mechanism, purview, partition, repertoire=None)¶
Return the \(\varphi\) of a mechanism over a purview for the given partition.
- Parameters
mechanism (tuple[int]) – The nodes in the mechanism.
purview (tuple[int]) – The nodes in the purview.
partition (Bipartition) – The partition to evaluate.
- Keyword Arguments
repertoire (np.array) – The unpartitioned repertoire. If not supplied, it will be computed.
- Returns
The distance between the unpartitioned and partitioned repertoires, and the partitioned repertoire.
- Return type
tuple[int, np.ndarray]
- find_mip(direction, mechanism, purview)¶
Return the minimum information partition for a mechanism over a purview.
- Parameters
- Returns
The irreducibility analysis for the mininum-information partition in one temporal direction.
- Return type
- cause_mip(mechanism, purview)¶
Return the irreducibility analysis for the cause MIP.
Alias for
find_mip()
withdirection
set toCAUSE
.
- effect_mip(mechanism, purview)¶
Return the irreducibility analysis for the effect MIP.
Alias for
find_mip()
withdirection
set toEFFECT
.
- phi_cause_mip(mechanism, purview)¶
Return the \(\varphi\) of the cause MIP.
This is the distance between the unpartitioned cause repertoire and the MIP cause repertoire.
- phi_effect_mip(mechanism, purview)¶
Return the \(\varphi\) of the effect MIP.
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.
- potential_purviews(direction, mechanism, purviews=False)¶
Return all purviews that could belong to the
MaximallyIrreducibleCause
/MaximallyIrreducibleEffect
.Filters out trivially-reducible purviews.
- find_mice(direction, mechanism, purviews=False)¶
Return the
MaximallyIrreducibleCause
orMaximallyIrreducibleEffect
for a mechanism.- Parameters
- 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
MaximallyIrreducibleCause
orMaximallyIrreducibleEffect
.- Return type
- mic(mechanism, purviews=False)¶
Return the mechanism’s maximally-irreducible cause (
MaximallyIrreducibleCause
).Alias for
find_mice()
withdirection
set toCAUSE
.
- mie(mechanism, purviews=False)¶
Return the mechanism’s maximally-irreducible effect (
MaximallyIrreducibleEffect
).Alias for
find_mice()
withdirection
set toEFFECT
.
- phi_max(mechanism)¶
Return the \(\varphi^{\textrm{max}}\) of a mechanism.
This is the maximum of \(\varphi\) taken over all possible purviews.
- property 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, cause_purviews=False, effect_purviews=False)¶
Return the concept specified by a mechanism within this subsytem.
- Parameters
mechanism (tuple[int]) – The candidate set of nodes.
- Keyword Arguments
purviews (tuple[tuple[int]]) – Restrict the possible purviews to those in this list.
cause_purviews (tuple[tuple[int]]) – Restrict the possible cause purviews to those in this list. Takes precedence over
purviews
.effect_purviews (tuple[tuple[int]]) – Restrict the possible effect purviews to those in this list. Takes precedence over
purviews
.
- Returns
The pair of maximally irreducible cause/effect repertoires that constitute the concept specified by the given mechanism.
- Return type