Read the usage example from the official document of PyPhi, a library that deals with integrated information theory (IIT), and actually move it to deepen your understanding.
Previous article covered the introduction of the library and a simple calculation example.
This time, let's take a look at an example of using XOR Network from the official document.
I'm just writing with a rough Japanese translation with really insufficient knowledge, so I would be very grateful if an expert pointed out.
The original article is here
Consider a complete graph in which A, B, and C are connected. A, B, and C each have no bond with themselves.
Suppose that each element acts as an XOR circuit, and its own state (1 or 0) is determined by the input from two connected vertices.
Create this network. This network just seems to be provided as an example in the library (including connection, TPM, label name ABC).
import pyphi
network = pyphi.examples.xor_network()
The initial state is (0, 0, 0).
state = (0, 0, 0)
In this article, we'll look at a structure called the major complex.
major_complex = pyphi.compute.major_complex(network, state)
Is it okay to understand that this is an extraction of the main part of the network, ... in this case, it seems to be consistent with creating a SubSystem consisting of (A, B, C).
The guy who followed the example in the documentation.py
print(major_complex.phi) # 1.874999
print(major_complex.subsystem) # Subsystem(A, B, C)
'''
The following is the method calculated last time. The calculated phi match.
subsystem = pyphi.Subsystem(network, state)
print(pyphi.compute.phi(subsystem)) # 1.874999
'''
We will proceed with the calculation around this major complex.
From the major complex, let's look at the element called cause-effect structure (ces).
ces = major_complex.ces
What's going on inside this?
print(len(ces)) # 3
It looks like an array of length 3. Let's take a look at the label attached to each element.
print(ces.labeled_mechanisms)
# (['A', 'B'], ['A', 'C'], ['B', 'C'])
It seems that A and B, A and C, and B and C are the elements called'concept'of this network.
I will look back a little and explain.
First, the cause-effect structure is a structure that affects each other between networks when the state changes from $ t -1 $ to $ t $ or from $ t $ to $ t + 1 $. That is.
A network of components that are made by subdividing the elements that make up the network and cutting down to the point where information cannot be reduced is called a'concept'.
In the case of this network, it seems that A-B, A-C, and B-C are each'concept'.
Now let's focus on the first concept.
concept = ces[0]
print(concept.mechanism) # (0, 1)
Let's take a look at the concept of a network consisting of nodes 0, 1 (can't display labels in this state?).
Let's calculate Φ only with this network.
print(concept.phi) # 0.5
It seems that $ φ = 0.5 $ for this network alone.
Let's take a look at the purview (range?) Of cause (cause, factor?) Of this network. In other words, which network determines the current state of the network?
print(concept.cause.purview)
# (0, 1, 2)
It seems that the network of nodes (0, 1, 2) (well, all in short) is influencing.
Now let's take a look at the cause repertoire of this network.
print(concept.cause.repertoire)
'''
[[[0.5 0. ]
[0. 0. ]]
[[0. 0. ]
[0. 0.5]]]
'''
I received this output. This shape is a little difficult to understand, so I will write a table below that carefully describes the omitted parts.
t-State at 1 | State at t(0, 0, 0)Probability of contributing to | |||
---|---|---|---|---|
A | B | C | ||
0 | 0 | 0 | → | 0.5 |
1 | 0 | 0 | → | 0 |
0 | 1 | 0 | → | 0 |
1 | 1 | 0 | → | 0 |
0 | 0 | 1 | → | 0 |
1 | 0 | 1 | → | 0 |
0 | 1 | 1 | → | 0 |
1 | 1 | 1 | → | 0.5 |
This is what it means.
If you think about it, in order to become (0,0,0) in a network consisting entirely of xor, the previous step is either (0, 0, 0) or (1, 1, 1). There can only be. This table shows that.
Let's take a look at purview and repertoire about the effect of this network.
print(concept.effect.purview)
# (2,)
print(concept.effect.repertoire)
# [[[1. 0.]]]
This time it seems that it only affects node 2. It looks like this on the table.
t+State at 1 | State at t(0, 0, 0)Probability of changing from | |
---|---|---|
C | ||
0 | ← | 1 |
1 | ← | 0 |
From (0, 0, 0), node 2 can only change to 0.
cause is the "cause" and we look at the effect of the change from $ t-1 $ to $ t $.
The effect is the "result", which looks at the effect of the change from $ t $ to $ t + 1 $.
In the calculation of IIT (Integrated Information Theory), these two are divided and calculated. In general, use either of the two values, "low score", as the final value.
The table below summarizes the impact of the entire network and the concept.
Construction | φ | cause purview(Cause range) | effect purview(Range of effect) |
---|---|---|---|
Looking at this, the points are that "the entire ABC that is a component is included in the Major Complex", "the combination of AB, AC, and BC is a factor", "A, You can see that B and C alone do not become a'concept'that determines the network structure, and that the ABC triple network does not become a'concept'.
Is A alone really worthless? Let's calculate.
Let's create a single and whole subsystem.
subsystem = pyphi.examples.xor_subsystem()
A = (0,)
ABC = (0, 1, 2)
Is there an influence of A on each of cause and effect?
print(subsystem.cause_info(A, ABC))
# 0.5
print(subsystem.effect_info(A, ABC))
# 0
You can see that A alone has no value in terms of effect.
This means that in an xor circuit composed of A, B, and C, it is not possible to determine the value of B or the value of C when A is determined to be "1". It is not valuable as information unless it is made into two sets.
Next, let's see if the three nodes of "ABC" are not concepts. Let's do the same calculation.
subsystem.cause_info(ABC, ABC)
# 0.749999
I see, there is certainly cause information. But what if this is "the smallest component?"
Let's calculate what is called the minimum information partition (MIP).
mip = subsystem.cause_mip(ABC, ABC)
print(mip.phi)
# 0.0
The fact that φ = 0 that appears here means that there is no "misalignment" between the values "when calculating by dividing ABC" and "when calculating with the entire ABC" (probably. I'm not confident here)
How are they separated? Let's take a look.
print(mip.partition)
'''
A B,C
─── ✕ ─────
∅ A,B,C
'''
Something like AA came out. The formula is rewritten as follows.
This formula expresses that "if the information of BC is known, the information of A can be completely truncated".
For example, if the (0, 0) of B and C is known in the previous state, A is always 0.
The same can be said for the following two.
Now we know that AB, AC and BC are the'concepts' that make up this network.
This is the end of this article. Almost all the contents so far are Japanese translations of the following articles.
Official PyPhi Documentation-XOR Network https://pyphi.readthedocs.io/en/latest/examples/xor.html
Also, I wrote it on the assumption that I have read Previous article.