wmayner / pyphi

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

AttributeError: module 'pyphi' has no attribute 'tpm' #19

Closed ZHam2012 closed 6 years ago

ZHam2012 commented 6 years ago

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'

wmayner commented 6 years ago

PyPhi v0.9.0 was released just a few days ago, so the documentation for the "stable" version now refers to v0.9.0. It's possible that you installed PyPhi just before the release and are using v0.8.1. You can see which version you have with

>>> print (pyphi.__version__)

Try upgrading with pip install pyphi --upgrade and the tpm module should be available.