pyphi.substrate_generator.mechanisms#

Library of unit mechanisms ported from Bjørn Juel’s substrate_modeler.

Each mechanism is a unit function with the signature f(element, weights, state, **params) -> float returning the probability that element is ON at the next step, given the substrate state at the current step. This is the contract consumed by pyphi.substrate_generator.build_tpm() (it is called once per from-state), so the assembled substrate TPM equals the dynamic_tpm of the substrate_modeler library, in which the present state equals the past state.

State-dependent mechanisms (the “endorsement” family — resonator(), mismatch_corrector(), stabilized_sigmoid(), biased_sigmoid(), modulated_sigmoid()) read the unit’s own current state, state[element]. They therefore require a self-loop (a nonzero weights[element, element]) so that the dependency is represented in the connectivity matrix; pyphi.substrate_generator.create_substrate() inserts it automatically.

resonator realizes the state-dependent coupling of the matching paper (Mayner, Juel & Tononi), whose default weight_scale_mapping is the coupling factor g(I_j, s_k) of that paper’s appendix.

Functions

and_gate(element, weights, state, *[, ...])

Two-input AND truth table (ceiling only when both inputs are ON).

biased_sigmoid(element, weights, state, *, ...)

Sigmoid biased toward the last input unit's state: when the bias unit is OFF the activation is divided by the bias factor; when ON, the inactivation is divided by it.

copy_gate(element, weights, state, *[, ...])

Single-input copy: output follows the input.

democracy(element, weights, state, *[, ...])

Activation equal to the mean of the (binary) input states.

gabor_gate(element, weights, state, *[, ...])

Gabor-like detector: ceiling on a preferred input pattern, floor on its complement (anti-pattern), and 0.5 otherwise.

majority(element, weights, state, *[, ...])

Activation equal to the rounded mean of the (binary) input states.

mismatch_corrector(element, weights, state, *)

Single-input corrector: when the unit and its input match, it relaxes toward 0.5 (biased by bias); when they mismatch, it copies the input.

mismatch_pattern_detector(element, weights, ...)

Pattern detector that responds strongly to mismatched inputs: weakly coupled to inputs matching its current state, strongly to unexpected ones.

modulated_sigmoid(element, weights, state, ...)

Sigmoid whose threshold and determinism are shifted by the number of active modulator inputs, scaled by the unit's own (Ising) state.

or_gate(element, weights, state, *[, floor, ...])

Two-input OR truth table (floor only when both inputs are OFF).

resonator(element, weights, state, *, ...[, ...])

State-dependent endorsement: inputs that agree with the unit's own state are excitatory and amplified; disagreeing inputs are inhibitory.

sigmoid(element, weights, state, *[, floor, ...])

Logistic activation of the weighted input.

sor_gate(element, weights, state, *[, ...])

Selective-OR detector: ON with probability ceiling iff the input pattern is one of pattern_selection, otherwise OFF.

stabilized_sigmoid(element, weights, state, ...)

Sigmoid whose modulators stabilize the unit's current state, more strongly the more modulators are active.

weighted_mean(element, weights, state, *[, ...])

Spin-weighted mean of the inputs, using the (normalized) input weights.

xor_gate(element, weights, state, *[, ...])

Two-input XOR truth table (ceiling iff the inputs differ).