You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The previous implementation computed Φ as an entropy difference when
connections are cut — this is NOT how IIT works. IIT 3.0 (Oizumi,
Albantakis & Tononi, 2014) defines Φ as the minimum information
partition (MIP): the bipartition whose unidirectional cut loses the
least integrated information, measured by KL divergence between the
whole-system and cut-system cause-effect repertoires.
Core changes to integrated_information.py:
1. New _build_tpm(sorted_nodes, cut_from, cut_to) method:
- Builds a 2^n × n state-by-node Transition Probability Matrix
- Supports optional unidirectional cuts (severing connections from
one partition to the other)
- Handles sigmoid, threshold, and linear activation functions
- Adds epsilon noise (1e-10) for numerical stability
2. New _get_current_binary_state(sorted_nodes) method:
- Converts continuous element states to binary (threshold 0.5)
3. New _effect_distribution_from_sbn_tpm(tpm, state, n) method:
- Converts a TPM row to a full 2^n probability distribution
- Assumes conditional independence of node transitions (standard IIT)
4. New _kl_divergence(p, q) static method:
- KL divergence D_KL(P||Q) with epsilon safeguards
5. Replaced _compute_phi_for_subset(subset):
- Builds whole-system TPM once
- For each bipartition (A, B), tries BOTH unidirectional cuts:
* Sever A→B connections (keep B→A)
* Sever B→A connections (keep A→B)
- Computes KL divergence between whole and cut distributions
- Φ = minimum KL across all bipartitions and cut directions
- This correctly implements the MIP from IIT 3.0
6. Replaced _approximate_phi(subset):
- Now uses spectral approximation (Fiedler value of the graph
Laplacian × average edge weight) instead of random sampling
- Algebraic connectivity correlates with Φ (Tononi & Sporns, 2003)
- Returns 0 for disconnected graphs, positive for connected ones
7. Removed dead methods:
- _calculate_partition_phi (broken entropy-difference approach)
- _calculate_system_entropy (no longer needed)
- _tensor_product_distribution (unused after unidirectional cut refactor)
Key IIT properties now correctly satisfied:
- Disconnected elements → Φ = 0 (no cross-partition connections)
- Single element → Φ = 0 (no bipartition possible)
- Feed-forward COPY gate → Φ = 0 (cutting B→A is free since no B→A exists)
- Fully connected recurrent network (all-ON state) → Φ > 0
- Φ is state-dependent (IIT 3.0 property — OFF nodes contribute zero input)
- More connectivity → higher Φ (general trend)
New tests in test_consciousness_engine.py (12 tests):
- test_tpm_shape: 3-element system produces 8×3 TPM
- test_tpm_rows_sum_to_valid_probabilities: all entries in [0,1]
- test_tpm_effect_distribution_sums_to_one: distribution is normalized
- test_phi_recurrent_integrated_network: Tononi triangle has Φ > 0
- test_phi_copy_gate: feed-forward COPY has Φ = 0
- test_phi_increases_with_connectivity: dense > sparse
- test_phi_disconnected_still_zero: no connections → Φ = 0
- test_phi_single_element_still_zero: singleton → Φ = 0
- test_kl_divergence_identical_distributions: KL(P||P) = 0
- test_kl_divergence_different_distributions: KL(P||Q) > 0
- test_approximate_phi_large_subset: disconnected large set → Φ ≈ 0
- test_approximate_phi_connected_large_subset: connected ring → Φ > 0
All existing tests continue to pass (70 total in consciousness tests).
Full suite: 3164 passed, 25 skipped, 0 failures.
References:
- Oizumi, Albantakis & Tononi (2014) 'From the Phenomenology to the
Mechanisms of Consciousness: IIT 3.0', PLOS Comp Bio
- PyPhi (github.com/wmayner/pyphi) — reference implementation consulted
for TPM conventions and unidirectional cut semantics
Closes#6
0 commit comments