-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial support for Implicit TPMs #105
Open
isacdaavid
wants to merge
191
commits into
feature/iit-4.0
Choose a base branch
from
feature/tpm-class
base: feature/iit-4.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Remove inconsequential assignments introduced in bfd62c and 99ad3f.
Thus allowing xarray DataArrays to have anonymous singleton dimensions.
It turns out that, while allowed on a DataArray-level, nameless singleton dimensions cannot be aligned at the Dataset level.
…for ImplicitTPMs
In `subsystem.find_mice`, computing potential purviews can be very expensive in some situations, and if the user has provided a short iterable of purviews, then computing the potential purviews is not worth it. So, we simply use the user-provided purviews directly, allowing the user to decide whether to filter out reducible purviews.
…into feature/tpm-class
…bolic intersection.
…quivalence classes
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This might probably require further prettifying, and I have just started writing tests for the new code, documentation, etc. That said, it's mature enough to ask for review and suggestions. Test results are on par with the 4.0 branch, the examples I run are working. Also, I want to get a sense of merge conflicts.
This is what the code is supposed to be doing (also, a mini guide for users):
Network
creation remain supported. Users shouldn't need to update their old scripts 90% of the time. API breakage is mostly contained withinnode.py
. The new TPM format obviously looks different, but most of the existing API has been either inherited or re-implemented for it.Network
creation. ImplicitTPMs are supposed to be the new common currency throughout pyphi (help us spot leftovers and subpar conversions!).ImplicitTPM
is with a list or tuple of node TPMs, where each node TPM looks very much like a multidimensional explicit TPM with one dimension per node in the network (inputs to node contribute nonsingleton dimensions, non-inputs contribute singletons), plus the last dimension containing the probabilities for this node at t+1. Instead of only providing probabilities for the ON state, that last dimension must contain entries for all states (to simplify our work regardless of whether the node is binary or not). Users can look at the existingmy_subsystem.nodes[i].tpm
to get a sense node TPMs.Example using the 2nd system in fig. 7C in the IIT 4.0 paper:
ExplicitTPM
to aImplicitTPM
? You can do it indirectly, by defining aNetwork
and extracting its.tpm
attribute. Also see (assuming candidate system is whole network)[node.tpm for node in my_subsystem.nodes]
and (more involved!)pyphi.node.generate_nodes
.ImplicitTPM
back toExplicitTPM
?pyphi.tpm.reconstitute_tpm
Network
. If absent, pyphi will infer thecm
from the node TPMs, or report inconsistencies in the TPM. If passed, thecm
will be used to validate that it matches the TPM. When passing an explicit TPM, the behavior of thecm
parameter is as before (assumes all-to-all if absent).Network
(as well as a corresponding attribute):state_space
. This can be used to define state labels for each node. If absent, pyphi will create a default state space using int's as state indices (like 0 for OFF, 1 for ON as previously implied).ImplicitTPM
s have fancier indexing. In addition to the regular numpy syntax using positional indexing with integers and slices, there's also pandas/xarray-like indexing by name:Network
s . There are several places throughout the source code that still assume binary units, so correct analyses aren't guaranteed nor tested. This patch paves the way. though.