wmayner / pyphi

A toolbox for integrated information theory.
https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1006343
Other
379 stars 97 forks source link

Update an option for checking the strong connectivity of connectivity matrix. #111

Closed Astrocytes120 closed 11 months ago

isacdaavid commented 11 months ago

It looks good to me. Thoughts @wmayner ?

snippet at work:

import pyphi
import numpy as np

node_labels = ("A", "B", "C")

tpm = np.array(
    [
        [1, 0, 0],
        [0, 1, 0],
        [1, 1, 1],
        [0, 1, 1],
        [0, 0, 0],
        [1, 1, 0],
        [0, 0, 1],
        [1, 0, 1],
    ]
)

connectivity_matrix = np.array([
    [1, 1, 0,],
    [0, 1, 0,],
    [0, 0, 1,],
])

network = pyphi.Network(tpm, cm=connectivity_matrix, node_labels=node_labels)

state = (1, 0, 0)

subsystem_backward = pyphi.Subsystem(
    network,
    state,
    nodes=node_labels,
    backward_tpm=True
)

subsystem_forward = pyphi.Subsystem(
    network,
    state,
    nodes=node_labels
)

pyphi.backwards.sia(subsystem_backward, subsystem_forward)

┌──────────────────────────────────┐
│ NullSystemIrreducibilityAnalysis │
│     ━━━━━━━━━━━━━━━━━━━━━━━      │
│        Subsystem:  A,B,C         │
│                Φ: 0.0            │
│            CAUSE:  (0,0,0)       │
│             II_c: 0.25           │
│           EFFECT:  (0,1,0)       │
│             II_e: 0.25           │
└──────────────────────────────────┘

Tests:

Before: 97 failed, 581 passed, 32 skipped, 22 deselected, 2 xfailed, 22 errors in 1441.59s (0:24:01)

After: 97 failed, 581 passed, 32 skipped, 22 deselected, 2 xfailed, 22 errors in 1343.88s (0:22:23)

wmayner commented 11 months ago

This is a good idea, but we should integrate the logic into the existing system for checking short-circuit conditions rather than copy-pasting from the 3.0 code path.

This would mean adding another function like the one on this line.

@Astrocytes120 , would you be willing to update the PR accordingly? Then we can review and approve.

Astrocytes120 commented 11 months ago

Yes, I think that is a valid point. I would check the line you pointed out.

Thanks, Myeongjin Jeong.

12/14/23 오후 10:49, William Mayner @.***> 작성:

This is a good idea, but we should integrate the logic into the existing system for checking short-circuit conditions rather than copy-pasting from the 3.0 code path.

This would mean adding another function like the one on this line https://github.com/wmayner/pyphi/pull/111/files#diff-26742afb055ef4973f0411d53fff2bc986969e5fbd3afc80a1ee4b32eecb20ccR360.

@Astrocytes120 https://github.com/Astrocytes120 , would you be willing to update the PR accordingly? Then we can review and approve.

— Reply to this email directly, view it on GitHub https://github.com/wmayner/pyphi/pull/111#issuecomment-1857272575, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQ5HNHL3VBFZAA7L5FZ3FPTYJPJDZAVCNFSM6AAAAABAINO7WGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJXGI3TENJXGU. You are receiving this because you were mentioned.