wmayner / pyphi Goto Github PK
View Code? Open in Web Editor NEWA toolbox for integrated information theory.
Home Page: https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1006343
License: Other
A toolbox for integrated information theory.
Home Page: https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1006343
License: Other
Using the exact code in /github.com/wmayner/pyphi on windows10 python 3.8, the execution hangs after producing this line:
Computing concepts: 0%| | 0/3 [00:00<?, ?it/s]
Sorry, there was a mess of me, please close or delete this problem.
As Max Tegmark pointed out here:
https://www.youtube.com/watch?v=QnEtNC8eFso or
https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1005123
there are many alternative ways of computing phi (he gives 420). For example you can choose how to compute the probability distributions, or which metric to use to compare them. I noticed in pyphi_config.yml
that you support changing the distance metric with: MEASURE: "EMD"
. Do you have some support for other options he talks about? If not do you plan to add them in the future?
https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life
When a cell is alive, it has 140 possible predecessor patterns, if it is dead, 372.
Can one apply IIT to visualize phi values and subject boundaries?
I found one of your previous publications which applied IIT to elementary cellular automata: https://www.mdpi.com/1099-4300/17/8/5472
Are you aware of anyone who considered the 2D, 3D or even smooth-case?
Edit: From your answer here I can see that this problem seems to be currently computationally intractable, even in regular systems such as these.
Hello,
I am having following import error on Mac m1 silicon chip Pycharm python 3.11.1 & 2.7.18
ImportError: cannot import name 'Iterable' from 'collections' (/Library/Frameworks/Python.framework/
Versions/3.11/lib/python3.11/collections/__init__.py)
**import pyphi**
Sorry, there was a mess of me, please close or delete this problem.
The given command line,
conda install -c wmayner pyphi
results in the error:
PackagesNotFoundError: The following packages are not available from current channels:
- pyphi
hi,
I'm investigating a solution when trying to run test_actual.py
(IIT) [diego@diego test]$ python *actual.py but I get the following error:
Welcome to PyPhi!
If you use PyPhi in your research, please cite the paper:
Mayner WGP, Marshall W, Albantakis L, Findlay G, Marchman R, Tononi G.
(2018). PyPhi: A toolbox for integrated information theory.
PLOS Computational Biology 14(7): e1006343.
https://doi.org/10.1371/journal.pcbi.1006343
Documentation is available online (or with the built-in `help()` function):
https://pyphi.readthedocs.io
To report issues, please use the issue tracker on the GitHub repository:
https://github.com/wmayner/pyphi
For general discussion, you are welcome to join the pyphi-users group:
https://groups.google.com/forum/#!forum/pyphi-users
To suppress this message, either:
- Set `WELCOME_OFF: true` in your `pyphi_config.yml` file, or
- Set the environment variable PYPHI_WELCOME_OFF to any value in your shell:
export PYPHI_WELCOME_OFF='yes'
Traceback (most recent call last):
File "/home/diego/anaconda3/envs/IIT/lib/python3.9/site-packages/b/pyphi-feature-iit-4.0/test/test_actual.py", line 99, in <module>
(pytest.lazy_fixture("background_all_off"), Direction.EFFECT, (0,), (1,), 1),
File "/home/diego/anaconda3/envs/IIT/lib/python3.9/site-packages/pytest/__init__.py", line 171, in __getattr__
raise AttributeError(f"module {__name__} has no attribute {name}")
AttributeError: module pytest has no attribute lazy_fixture
(IIT) [diego@diego test]$
also to test_json.py:
(IIT) [diego@diego test]$ python *json.py
Welcome to PyPhi!
If you use PyPhi in your research, please cite the paper:
Mayner WGP, Marshall W, Albantakis L, Findlay G, Marchman R, Tononi G.
(2018). PyPhi: A toolbox for integrated information theory.
PLOS Computational Biology 14(7): e1006343.
https://doi.org/10.1371/journal.pcbi.1006343
Documentation is available online (or with the built-in `help()` function):
https://pyphi.readthedocs.io
To report issues, please use the issue tracker on the GitHub repository:
https://github.com/wmayner/pyphi
For general discussion, you are welcome to join the pyphi-users group:
https://groups.google.com/forum/#!forum/pyphi-users
To suppress this message, either:
- Set `WELCOME_OFF: true` in your `pyphi_config.yml` file, or
- Set the environment variable PYPHI_WELCOME_OFF to any value in your shell:
export PYPHI_WELCOME_OFF='yes'
Traceback (most recent call last):
File "/home/diego/anaconda3/envs/IIT/lib/python3.9/site-packages/b/pyphi-feature-iit-4.0/test/test_json.py", line 10, in <module>
from test_actual import transition
File "/home/diego/anaconda3/envs/IIT/lib/python3.9/site-packages/b/pyphi-feature-iit-4.0/test/test_actual.py", line 99, in <module>
(pytest.lazy_fixture("background_all_off"), Direction.EFFECT, (0,), (1,), 1),
File "/home/diego/anaconda3/envs/IIT/lib/python3.9/site-packages/pytest/__init__.py", line 171, in __getattr__
raise AttributeError(f"module {__name__} has no attribute {name}")
AttributeError: module pytest has no attribute lazy_fixture
(IIT) [diego@diego test]$
I'm trying to import network.json as described here Figure 7 (import network.json file) and I get the error below. Would anyone have any idea what I'm probably doing wrong?
>>> network = pyphi.network.from_json('/home/me/network.json')
>>> network.tpm
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'dict' object has no attribute 'tpm'
>>>
Hi,
Do you have an easy application of this measure to a training Deep NN on TensorFlow or Keras for example? I'd like to see for example how phi evolves during training, if it steadily increases, and which absolute value it achieves.
I'd love to play with it and I bet it would have a huge impact to the spread of interest into IIT.
Thanks for the good work,
Luca
Hey man,
I am not sure if I did something wrong on my Ubuntu-Server, but I had to add import collections.abc
to the file .../pyphi/models/cuts.py
.
Cheers,
Dominik
Hey guys,
It seems that pyphi isn't stable anymore. I got a multithreading exception:
Traceback (most recent call last): File "/usr/lib/python3.4/multiprocessing/queues.py", line 242, in _feed obj = ForkingPickler.dumps(obj) File "/usr/lib/python3.4/multiprocessing/reduction.py", line 50, in dumps cls(buf, protocol).dump(obj)
Could you maybe help me with this issue?
Python 3.12 has landed in Fedora. Rebuilding pyphi with Python 3.12 results in the following test failure:
=================================== FAILURES ===================================
___________________________ [doctest] 2014paper.rst ____________________________
549
550 Figure 12
551 ~~~~~~~~~
552
553 **Assessing the integrated conceptual information Φ of a constellation C.**
554
555 To calculate :math:`\Phi^{\textrm{MIP}}` for a candidate set, we use the
556 function |compute.sia()|:
557
558 >>> sia = pyphi.compute.sia(subsystem)
UNEXPECTED EXCEPTION: ValueError("Unable to configure handler 'queue'")
Traceback (most recent call last):
File "/usr/lib64/python3.12/doctest.py", line 1357, in __run
exec(compile(example.source, filename, "single",
File "<doctest 2014paper.rst[78]>", line 1, in <module>
File "/builddir/build/BUILD/pyphi-1.2.1/pyphi/compute/subsystem.py", line 323, in sia
return _sia(_sia_cache_key(subsystem), subsystem)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/builddir/build/BUILD/pyphi-1.2.1/pyphi/memory.py", line 35, in wrapper
return f(*args, **kwargs)
^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/decorator.py", line 232, in fun
return caller(func, *(extras + args), **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/builddir/build/BUILD/pyphi-1.2.1/pyphi/utils.py", line 213, in time_annotated
result = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/builddir/build/BUILD/pyphi-1.2.1/pyphi/compute/subsystem.py", line 262, in _sia
unpartitioned_ces = _ces(subsystem)
^^^^^^^^^^^^^^^
File "/builddir/build/BUILD/pyphi-1.2.1/pyphi/compute/subsystem.py", line 208, in _ces
return ces(subsystem, parallel=config.PARALLEL_CUT_EVALUATION)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/decorator.py", line 232, in fun
return caller(func, *(extras + args), **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/builddir/build/BUILD/pyphi-1.2.1/pyphi/utils.py", line 213, in time_annotated
result = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/builddir/build/BUILD/pyphi-1.2.1/pyphi/compute/subsystem.py", line 96, in ces
return CauseEffectStructure(engine.run(parallel or
^^^^^^^^^^^^^^^^^^^^^^
File "/builddir/build/BUILD/pyphi-1.2.1/pyphi/compute/parallel.py", line 331, in run
return self.run_parallel()
^^^^^^^^^^^^^^^^^^^
File "/builddir/build/BUILD/pyphi-1.2.1/pyphi/compute/parallel.py", line 266, in run_parallel
r.reraise()
File "/builddir/build/BUILD/pyphi-1.2.1/pyphi/compute/parallel.py", line 64, in reraise
raise self.exception.with_traceback(self.tb.as_traceback())
File "/builddir/build/BUILD/pyphi-1.2.1/pyphi/compute/parallel.py", line 174, in worker
configure_worker_logging(log_queue)
^^^^^^^^^^^^^^^^^
File "/builddir/build/BUILD/pyphi-1.2.1/pyphi/compute/parallel.py", line 361, in configure_worker_logging
logging.config.dictConfig(
^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.12/logging/config.py", line 912, in dictConfig
dictConfigClass(config).configure()
^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.12/logging/config.py", line 588, in configure
raise ValueError('Unable to configure handler '
^^^^^^^^^^^^^^^^^
ValueError: Unable to configure handler 'queue'
/builddir/build/BUILD/pyphi-1.2.1/docs/examples/2014paper.rst:558: UnexpectedException
from graphiit import Graph
import pyphi
import sys
import numpy
numpy.set_printoptions(threshold=sys.maxsize)
pyphi.config.PARALLEL_CONCEPT_EVALUATION = True
pyphi.config.NUMBER_OF_CORES = -1
pyphi.config.MAXIMUM_CACHE_MEMORY_PERCENTAGE = 100
graph_config = [
('A','AND','B','C','D','E','F','G','H','I','J','K','L'),
('B','NAND','A','C','D','E','F','G','H','I','J','K','L'),
('C','OR','A','B','D','E','F','G','H','I','J','K','L'),
('D','COPY','A'),
('E','NOR','A','B','C','D','F','G','H','I','J','K','L'),
('F','NOT','A'),
('G','XOR','A','B','C','D','E','F','H','I','J','K','L'),
('H','XNOR','A','B','C','D','E','F','G','I','J','K','L'),
('I','MAJORITY','A','B','C','D','E','F','G','H','J','K','L'),
('J','MAJ','A','B','C','D','E','F','G','H','I','K','L'),
('K','MINORITY','A','B','C','D','E','F','G','H','I','J','L'),
('L','MIN','A','B','C','D','E','F','G','H','I','J','K')
]
graph = Graph(graph_config)
network = graph.pyphi_network()
state = (0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1)
subsystem = pyphi.Subsystem(network, state)
A, B, C, D, E, F, G, H, I, J, K, L = subsystem.node_indices
following the guidelines in https://pyphi.readthedocs.io/en/latest/examples/actual_causation.html:
X = Y = (A, B, C, D, E, F, G, H, I, J, K, L)
X_state = Y_state = (0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1)
transition = actual.Transition(network, X_state, Y_state, X, Y)
everything happens normally but when I do:
>>> transition.find_actual_cause((B, C))
or
account = actual.account(transition)
print(account)
get error:
~/anaconda3/lib/python3.9/site-packages/pyphi/actual.py in find_actual_cause(self, mechanism, purviews)
435 def find_actual_cause(self, mechanism, purviews=False):
436 """Return the actual cause of a mechanism."""
--> 437 return self.find_causal_link(Direction.CAUSE, mechanism, purviews)
438
439 def find_actual_effect(self, mechanism, purviews=False):
~/anaconda3/lib/python3.9/site-packages/pyphi/actual.py in find_causal_link(self, direction, mechanism, purviews, allow_neg)
426 else:
427 # This max should be most positive
--> 428 max_ria = max(self.find_mip(direction, mechanism, purview,
429 allow_neg)
430 for purview in purviews)
~/anaconda3/lib/python3.9/site-packages/pyphi/actual.py in <genexpr>(.0)
426 else:
427 # This max should be most positive
--> 428 max_ria = max(self.find_mip(direction, mechanism, purview,
429 allow_neg)
430 for purview in purviews)
~/anaconda3/lib/python3.9/site-packages/pyphi/actual.py in find_mip(self, direction, mechanism, purview, allow_neg)
342 partitioned_probability = self.partitioned_probability(
343 direction, partition)
--> 344 alpha = log2(probability / partitioned_probability)
345
346 # First check for 0
~/anaconda3/lib/python3.9/site-packages/pyphi/actual.py in log2(x)
40 def log2(x):
41 """Rounded version of ``log2``."""
---> 42 return round(_log2(x), config.PRECISION)
43
44
ValueError: math domain error
I know it's more likely that I'm doing something inappropriate, but I did not understand what ...
Also if:
transition.find_actual_cause((K, K))
then ...
CausalLink
α = 0.413 [A, C, D] ◀━━ [K, K]
why? whether alpha
smaller than 10 ** (- constant.epsilon)
, should return alpha = 0.0
and:
Filter out causal links with zero alpha
return DirectedAccount(filter(None, links))
When a shortcut is taken, no purview is attached to the MICE object. This can be confusing for users and should be indicated explicitly.
Hi @wmayner,
can you give some advice/help why I find it takes much longer to run compute.evaluate_cut
compared to simply running compute.big_mip
?
Here's a minimal script you can run, and also a net you can download
https://www.dropbox.com/s/705c2ne4gpj13qo/network_4_nodes_dev_pyphi.json?dl=0
to reproduce it exactly, (but I get the same behaviour for all other subsystems
too).
import pyphi
from pyphi.compute.big_phi import evaluate_cut
import json
from random import randint
from time import time
##---------------------------------------------------
# Import net and setup system
##---------------------------------------------------
import json
path_to_saved_net = "/home/ajay/Downloads/network.json"
with open(path_to_saved_net) as data_file:
data = json.load(data_file)
tpm = data['tpm']
cm = data['cm']
state = data['state']
network = pyphi.Network(tpm, connectivity_matrix=cm)
subsystem = pyphi.Subsystem(network, state, range(network.size))
#subsystem.node_indices
pyphi.config.CACHE_BIGMIPS = False
pyphi.config.PARALLEL_CUT_EVALUATION = False
##---------------------------------------------------
# Simple Big mip calculation
##---------------------------------------------------
def compute_big_mip(subsystem):
start = time()
for i in range (0,100):
mip = pyphi.compute.big_mip( subsystem )
print(time()-start)
##---------------------------------------------------
# Simple Big mip calculation and a random cut
##---------------------------------------------------
unpartitioned_constellation = pyphi.compute.constellation(subsystem)
all_bipartitions = pyphi.utils.directed_bipartition( subsystem.node_indices )[1:-1] # can be precomputed when the environment is initialized
num_all_directed_bipartitions = len(all_bipartitions)
def compute_big_mip_and_a_random_cut( subsystem ):
start = time()
for t in range (0,100):
mip = pyphi.compute.big_mip(subsystem)
i = randint(0, num_all_directed_bipartitions-1)
rand_bipartition = all_bipartitions[ i : i+1 ] # random directed bipartition
random_cut = [ pyphi.models.cuts.Cut ( bipartition[0], bipartition[1] ) for bipartition in rand_bipartition ] # random_cut
mip_of_rand_cut = evaluate_cut(subsystem, random_cut[0], unpartitioned_constellation) # pyphi/compute/big_phi.py#L27
print(time()-start)
##---------------------------------------------------
# Compare timings
##---------------------------------------------------
>>> compute_big_mip(subsystem)
10.356880187988281
>>>
>>> compute_big_mip_and_a_random_cut( subsystem )
39.57922887802124
So my question is why does it take 3 times as long to evaluate a single random cut, compare to evaluating the big_mip
for a full system which requires searching over many cuts?
If I can sort this out I'll be able to run some experiments, and can show you how to apply ML here.
Thanks a lot for your help,
Aj
HH,
i have open ipython, done import numpy as np and import pyphi. And then I have done
network = pyphi.network.from_json ('/home/ diego/ NET/network.json')
But when I run network.tpm I get the following error message below:
In [5]: network.tpm
----------------------------------------
AttributeErrorTraceback (most recent call last)
<ipython-input-5-044da6143242> in <module>
----> 1 network.tpm
AttributeError: 'dict' object has no attribute 'tpm'
What am I doing wrong? Should I get the TPM instead of the error message, or not?
I have pyphi 3.6.3 and I am working on one of the examples in conditional independence documentation on the link http://pyphi.readthedocs.io/en/stable/examples/conditional_independence.html , I am getting an error which says 'module pyphi has no attribute 'tpm' . How can I resolve this issue?
import numpy as np
import pyphi
tpm = pyphi.examples.cond_depend_tpm()
print(tpm)
[[ 1. 0. 0. 0. ]
[ 0. 0.5 0.5 0. ]
[ 0. 0.5 0.5 0. ]
[ 0. 0. 0. 1. ]]
sbs_tpm = pyphi.convert.state_by_node2state_by_state(sbn_tpm)
print(sbs_tpm)
[[ 1. 0. 0. 0. ]
[ 0.25 0.25 0.25 0.25]
[ 0.25 0.25 0.25 0.25]
[ 0. 0. 0. 1. ]]
tpm2 = pyphi.examples.cond_independ_tpm()
print(tpm2)
[[ 0.5 0. 0. 0. 0.5 0. 0. 0. ]
[ 0. 0.5 0. 0. 0. 0.5 0. 0. ]
[ 0. 0. 0.5 0. 0. 0. 0.5 0. ]
[ 0. 0. 0. 0.5 0. 0. 0. 0.5]
[ 0.5 0. 0. 0. 0.5 0. 0. 0. ]
[ 0. 0. 0.5 0. 0. 0. 0.5 0. ]
[ 0. 0.5 0. 0. 0. 0.5 0. 0. ]
[ 0. 0. 0. 0.5 0. 0. 0. 0.5]]
sbn_tpm2 = pyphi.convert.state_by_state2state_by_node(tpm2)
print(sbn_tpm2)
[[[[ 0. 0. 0.5]
[ 0. 0. 0.5]]
[[ 0. 1. 0.5]
[ 1. 0. 0.5]]]
[[[ 1. 0. 0.5]
[ 0. 1. 0.5]]
[[ 1. 1. 0.5]
[ 1. 1. 0.5]]]]
AB = [0, 1]
C = [2]
tpm2_marginalizeC = pyphi.tpm.marginalize_out(C, sbn_tpm2)
Traceback (most recent call last):
File "<pyshell#16>", line 1, in
tpm2_marginalizeC = pyphi.tpm.marginalize_out(C, sbn_tpm2)
AttributeError: module 'pyphi' has no attribute 'tpm'
Hi, thanks for your great work.
I'm running IIT 4.0 12 nodes 2^12=4096 state-by-state network on Google Colab Pro+ A100 GPU runtime. Please see this for the sample code.
Seems like the code is stack here (sorry, not sure about which of the lines gives the problem).
Is this expected (state matrix too large for computation) or do you think the problem lies in the matrix itself? Thanks!
subsystem_backward = pyphi.Subsystem(
network,
state,
nodes=node_labels,
backward_tpm=True
)
subsystem_forward = pyphi.Subsystem(
network,
state,
nodes=node_labels
)
While trying to do a clean install, I noticed that both scipy
and numpy
have breaking changes and the versions in setup.py
are not upper-bounded.
I was able to successfully install by installing the following versions:
scipy =1.2.1
numpy =1.16.2
When repeatly run pyphi.compute.phi(subsystem)
, the CPU using is continue growing and the program speed is contiune slowing down.
Neither on GitHub nor on PyPI has 1.2.1 officially been released. A tag on GitHub is all that points to version 1.2.1. Please consider releasing 1.2.1 on at least PyPI.
It would be good to have a function to compute relations only up to a certain order (perhaps an optional argument in the pyphi.relations.all_relations
function or a separate function).
Hi, I wonder if you can help me? I'm a bit new to this work and API, so this might be a silly question?
I've installed the latest development version, and I'm trying to calculate small phi over different partitions. I run this code,
import pyphi
from pyphi.subsystem import mip_bipartitions
network = pyphi.examples.fig6()
state = (1, 0, 0)
subsystem = pyphi.Subsystem(network, state, range(network.size))
A,B,C = subsystem.node_indices
mechanism = subsystem.node_indices
purview = subsystem.node_indices
all_bipartitions = mip_bipartitions( mechanism, purview )
partition = all_bipartitions[1]
direction = "|past|"
Can you help me use the following methods please? I don't understand why I'm getting these erros?
>>> subsystem.evaluate_partition( direction, (A,), (A, B, C) , partition )
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/ajay/anaconda3/lib/python3.6/site-packages/pyphi/subsystem.py", line 532, in evaluate_partition
partitioned_repertoire = self.partitioned_repertoire(direction, partition)
File "/home/ajay/anaconda3/lib/python3.6/site-packages/pyphi/subsystem.py", line 434, in partitioned_repertoire
return part1rep * part2rep
TypeError: unsupported operand type(s) for *: 'NoneType' and 'NoneType'
>>>
>>> subsystem.find_mip( direction, (A,) , (A,B,C) )
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/ajay/anaconda3/lib/python3.6/site-packages/pyphi/subsystem.py", line 587, in find_mip
unpartitioned_repertoire=unpartitioned_repertoire)
File "/home/ajay/anaconda3/lib/python3.6/site-packages/pyphi/subsystem.py", line 532, in evaluate_partition
partitioned_repertoire = self.partitioned_repertoire(direction, partition)
File "/home/ajay/anaconda3/lib/python3.6/site-packages/pyphi/subsystem.py", line 434, in partitioned_repertoire
return part1rep * part2rep
TypeError: unsupported operand type(s) for *: 'NoneType' and 'NoneType'
I guess my install is OK, as the functions see to be there
>>> subsystem.evaluate_partition
<bound method Subsystem.evaluate_partition of Subsystem((n0, n1, n2))>
>>> subsystem.find_mip
<bound method Subsystem.find_mip of Subsystem((n0, n1, n2))>
Thank you very much :)
Hey Will, or whoever else :)
I'm trying to get caching working, and I've noticed a curious bug in the following code:
XOR = lambda xs: sum(xs) == 1
nodes = [XOR, XOR, XOR]
current_state = (1, 0, 0)
past_state = ((0,))*len(current_state)
cm = [[1,1,1],
[1,0,1],
[1,1,1]]
tpm = get_tpm(nodes, cm) #(my function for generating a tpm)
network = pyphi.Network(tpm, current_state, past_state, connectivity_matrix=cm)
main_complex = pyphi.compute.main_complex(network)
Error:
...
File "/home/josh/.virtualenvs/IITipython3/lib/python3.4/site-packages/pyphi/concept_caching.py", line 276, in __init__
self.mechanism)
File "/home/josh/.virtualenvs/IITipython3/lib/python3.4/site-packages/pyphi/concept_caching.py", line 246, in _normalize_mice
mice.purview, mice.repertoire, normalized_indices)
File "/home/josh/.virtualenvs/IITipython3/lib/python3.4/site-packages/pyphi/concept_caching.py", line 221, in _normalize_purview_and_repertoire
purview = sorted(purview)
TypeError: 'NoneType' object is not iterable
This error only occurs when the network isn't fully connected (including self-connections). If you replace the 0
with a 1
in the connection matrix, all works as planned.
I'm using the pyphi version from pip install pyphi
.
Any thoughts?
Interactive changes to the configuration are not respected in subprocesses in Python 3.8 on macOS.
This is due to a change introduced in Python 3.8: on macOS, multiprocessing
starts processes with spawn
by default, instead of fork
. The subprocesses no longer receive the Config
object from the parent process and create their own, losing the interactive changes.
Relevant discussion on the Python bug tracker: https://bugs.python.org/issue33725
as per #25
I tried logging in to my google groups, and using URL:
https://groups.google.com/forum/#!forum/pyphi-users
I received a message that I did not have permission to view content
I did a search for pyphi-users, google reports not found
however I did not find a way to request membership,
I sent you an email, no response as yet!
When applying IIT to our universe, do the subject boundaries look more like Voronoi diagrams (the entire space is filled)
Will,
I understand the mailing list might prove more suitable. #32
Where is a simple worked example of PQR using gates on fpga
verilog or VHDL and demonstrating a value for φ
it would be helpful to me if both feedback and feedforward-only demonstrate same output with different φ!
apologies but I find python gets in the way of my initial understanding.
many thanks
It looks really cool:
https://pyphi.readthedocs.io/en/latest/_images/connectivity-matrix-example-network.png
https://en.wikipedia.org/wiki/Spectral_graph_theory
I wonder if there are any applications or equivalences to it.
I encountered this new thing while trying to run the test suite against the iit-4.0 branch, while also excluding the tests I had already found to be anti-sufficient for passing the suite.
It fails to collect test/test_subsystem_phi_max.py
before actual testing starts.
py.test --slow -k 'not test foo and not test bar and not test blablabla'
========================================= test session starts ==========================================
platform linux -- Python 3.10.5, pytest-7.1.2, pluggy-1.0.0 -- /usr/bin/python
cachedir: .pytest_cache
hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase('/home/isaac/pyphi/.hypothesis/examples')
rootdir: /home/isaac/pyphi, configfile: pytest.ini, testpaths: pyphi, test, docs
plugins: hypothesis-6.47.2, lazy-fixture-0.6.3, anyio-3.6.1
collected 641 items / 1 error
=======================ERRORS =========================
_________ERROR collecting test/test_subsystem_phi_max.py ________
test/test_subsystem_phi_max.py:16: in <module>
with config.override(REPERTOIRE_DISTANCE="EMD"):
pyphi/conf.py:367: in __enter__
self.conf.load_dict(self.new_values)
pyphi/conf.py:314: in load_dict
setattr(self, k, v)
pyphi/conf.py:293: in __setattr__
super().__setattr__(name, value)
pyphi/conf.py:220: in __set__
self._callback(obj)
pyphi/conf.py:246: in _callback
self.on_change(obj)
pyphi/conf.py:275: in wrapper
func(*args, **kwargs)
pyphi/conf.py:1061: in on_change_global
atomic_write_yaml(config.snapshot(), PYPHI_MANAGED_CONFIG_PATH)
pyphi/conf.py:1051: in atomic_write_yaml
Path(f.name).rename(path)
/usr/lib/python3.10/pathlib.py:1234: in rename
self._accessor.rename(self, target)
E OSError: [Errno 18] Invalid cross-device link: '/tmp/tmp7jw9h8j6' -> '__pyphi_cache__/config/pyphi_config.yml'
======================================== Hypothesis Statistics =========================================
======================================= short test summary info ========================================
ERROR test/test_subsystem_phi_max.py - OSError: [Errno 18] Invalid cross-device link: '/tmp/tmp7jw9h8...
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
=========================================== 1 error in 0.51s ===========================================
According to the internet, os.rename()
can't move files across filesystems, which is the case in my computer (although that doesn't explain why I'm only seeing the error until now):
$ df -h /tmp
Filesystem Size Used Avail Use% Mounted on
tmpfs 16G 1.5M 16G 1% /tmp
People suggest doing it in 2 steps: copying, removing. I simply bypassed this by making atomic_write_yaml()
write directly to the final path, but I don't know if either solution is "atomic" enough.
Hello,
We're seeing a test failing on s390x while building pyphi for NeuroFedora:
CPU info:
Architecture: s390x
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Big Endian
CPU(s): 3
On-line CPU(s) list: 0-2
Thread(s) per core: 1
Core(s) per socket: 1
Socket(s) per book: 1
Book(s) per drawer: 1
Drawer(s): 3
NUMA node(s): 1
Vendor ID: IBM/S390
Machine type: 2964
CPU dynamic MHz: 5000
CPU static MHz: 5000
BogoMIPS: 3033.00
Hypervisor: KVM/Linux
Hypervisor vendor: KVM
Virtualization type: full
Dispatching mode: horizontal
L1d cache: 384 KiB
L1i cache: 288 KiB
L2d cache: 6 MiB
L2i cache: 6 MiB
L3 cache: 64 MiB
L4 cache: 480 MiB
NUMA node0 CPU(s): 0-2
Vulnerability Itlb multihit: Not affected
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Not affected
Vulnerability Spec store bypass: Not affected
Vulnerability Spectre v1: Mitigation; __user pointer sanitization
Vulnerability Spectre v2: Mitigation; execute trampolines
Vulnerability Srbds: Not affected
Vulnerability Tsx async abort: Not affected
Flags: esan3 zarch stfle msa ldisp eimm dfp edat etf3eh highgprs te vx sie
The build logs are below:
+ py.test-3.9
============================= test session starts ==============================
platform linux -- Python 3.9.0rc1, pytest-6.0.2, py-1.9.0, pluggy-0.13.1 -- /usr/bin/python3
cachedir: .pytest_cache
rootdir: /builddir/build/BUILD/pyphi-1.2.0, configfile: pytest.ini
plugins: lazy-fixture-0.6.3
collecting ... collected 482 items / 1 error / 481 selected
==================================== ERRORS ====================================
_______________ ERROR collecting test/test_subsystem_phi_max.py ________________
test/test_subsystem_phi_max.py:63: in <module>
expected_mips = {
test/test_subsystem_phi_max.py:64: in <dictcomp>
cut: {
test/test_subsystem_phi_max.py:65: in <dictcomp>
direction: {
test/test_subsystem_phi_max.py:66: in <dictcomp>
mechanism: subsystem[cut].find_mip(direction, mechanism, purview)
pyphi/subsystem.py:585: in find_mip
phi, partitioned_repertoire = self�[39;49;00m.evaluate_partition(
pyphi/subsystem.py:535: in evaluate_partition
phi = repertoire_distance(
pyphi/distance.py:281: in repertoire_distance
dist = directional_emd(direction, r1, r2)
pyphi/distance.py:266: in directional_emd
return�[39;49;00m round�[39;49;00m(func(d1, d2), config.PRECISION)
pyphi/distance.py:143: in hamming_emd
return�[39;49;00m emd(d1, d2, _hamming_matrix(N))
pyemd/emd.pyx:49: in pyemd.emd.emd
?�[39;49;00m?�[39;49;00m?�[39;49;00m
E ValueError: Little-endian buffer not supported on big-endian compiler
=========================== short test summary info ============================
ERROR test/test_subsystem_phi_max.py - ValueError: Little-endian buffer not s...
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
=============================== 1 error in 1.14s ===============================
The complete build logs are attached:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.