Recent Releases of pyphi
pyphi - 1.2.0
Fixes
- Fixed a bug introduced into
pyphi.utils.load_data()by a breaking change in recent versions of NumPy that caused an error on import. - Fixed a bug where changing
config.PRECISIONdynamically did not changeconstants.EPSILON, causing some comparisons that relied onconstants.EPSILONto not reflect the new precision. - Changing
config.FS_CACHE_DIRECTORYandconfig.FS_CACHE_VERBOSITYnow causes a newjoblib.Memorycache to be created. Previously, changing these options dynamically had no effect. - Made test suite compatible with stricter usage of
pytestfixtures required by recent versions ofpytest.
API additions
- Added
pyphi.tpm.reconstitute_tpm().
API changes
- Renamed
pyphi.partition.partition_registrytopyphi.partition.partition_types. - Renamed
pyphi.distance.bld()topyphi.distance.klm(). - Fixed the connectivity matrix of the
disjunction_conjunction_network(). - Removed
'expanded_*_reperotire'attributes of JSON-serializedConcepts.
Config
- Added the
WELCOME_OFFoption to turn off the new welcome message.
Documentation
- Added documentation for the
partition_typesregistry. - Added documentation for the filesystem and database caches.
- Python
Published by wmayner over 6 years ago
pyphi - 1.1.0
Fixes
- Fixed a memory leaked when concepts returned by parallel CES computations were returned with distinct subsystem objects. Now all objects in a CES share the same subsystem reference.
- Fixed a race condition caused by newly introduced
tqdmsynchronization. Removed the existingProgressBarimplementation and pinnedtqdmto version >= 4.20.0. - Made model hashes deterministic (6b59061). This fixes an issue with the Redis MICE cache in which cached values were not shared between processes and program invokations.
API additions
- Added a
NodeLabelsobject for managing the labels of network elements. Most models now carry aNodeLabelsinstance that is used for string formatting. - Added the
cut_node_labelsproperty toSubsystemandMacroSubsystem. - Added
utils.time_annotateddecorator to measure execution speed.
API changes
- Specifying the nodes of a
Subsystemis now optional. If not provided, the subsystem will cover the entire network. - Removed the
labels2indices,indices2labelsandparse_node_indicesmethods fromNetwork, and theindices2labelsmethod fromSubsystem. - Renamed
config.load_config_filetoconfig.load_file, andconfig.load_config_dicttoconfig.load_dict - Removed backwards-compatible
Directionimport fromconstantsmodule. - Renamed
macro.coarse_graintocoarse_graining. - Exposed
coarse_grain,blackbox,time_scale,network_stateandmicro_node_indicesas attributes ofMacroSubsystem.
Config
- Removed the
LOG_CONFIG_ON_IMPORTconfiguration option.
- Python
Published by wmayner over 7 years ago
pyphi - 1.0.0
API changes
Modules
- Renamed:
compute.big_phitocompute.networkcompute.concepttocompute.subsystemmodels.big_phitomodels.subsystemmodels.concepttomodels.mechanism
Functions
- Renamed:
compute.main_complex()tocompute.major_complex()compute.big_mip()tocompute.sia()compute.big_phi()tocompute.phi()compute.constellation()tocompute.ces()compute.conceptual_information()tocompute.conceptual_info()subsystem.core_cause()tosubsystem.mic()subsystem.core_effect()tosubsystem.mie()subsystem.mip_past()tosubsystem.cause_mip()subsystem.phi_mip_past()tosubsystem.phi_cause_mip()subsystem.phi_mip_future()tosubsystem.phi_effect_mip()distance.small_phi_measure()todistance.repertoire_distance()distance.big_phi_measure()todistance.system_repertoire_distance()- For all functions in
convert: lolitole(little-endian)holitobe(big-endian)
- Removed
compute.concept(); useSubsystem.concept()instead.
Arguments
- Renamed
connectivity_matrixkeyword argument ofNetwork()tocm
Objects
- Renamed
BigMiptoSystemIrreducibilityAnalysis- Renamed the
unpartitioned_constellationattribute toces siais used throughout for attributes, variables, and function names instead ofbig_mip
- Renamed the
- Renamed
MiptoRepertoireIrreducibilityAnalysis- Renamed the
unpartitioned_repertoireattribute torepertoire riais used throughout for attributes, variables, and function names instead ofmip
- Renamed the
- Renamed
ConstellationtoCauseEffectStructurecesis used throughout for attributes, variables, and function names instead ofconstellation
Renamed
MicetoMaximallyIrreducibleCauseOrEffectmicormieare used throughout for attributes, variables, and function names instead ofmip
Similar changes were made to the
actualandmodels.actual_causationmodules.
Configuration settings
- Changed configuration settings as necessary to use the new object names.
Constants
- Renamed
Direction.PASTtoDirection.CAUSE - Renamed
Direction.CAUSEtoDirection.EFFECT
API additions
Configuration settings
- Added
CACHE_REPERTOIRESto control whether cause/effect repertoires are cached. Single-node cause/effect repertoires are always cached. - Added
CLEAR_SUBSYSTEM_CACHES_AFTER_COMPUTING_SIAto control whether subsystem caches are cleared after callingcompute.sia().
Objects
- Added two new objects,
MaximallyIrreducibleCauseandMaximallyIrreducibleEffect, that are subclasses ofMaximallyIrreducibleCauseOrEffectwith a fixed direction.
Refactor
- Moved network-level functions in
compute.big_phitopyphi.compute.network - Moved subsystem-level functions in
compute.big_phiandcompute.concepttocompute.subsystem
Documentation
- Added a description of TPM representations.
- Improved the explanation of conditional independence and updated the example to reflect that PyPhi now raises an error if a conditionally-dependent TPM is provided.
- Added detailed installation instructions.
- Little-endian and big-endian replace LOLI and HOLI terminology
- Added documentation for the following modules:
distributioncachecompute.parallelcomputetop-level modulemoduletop-level module
- Python
Published by wmayner about 8 years ago
pyphi - 0.9.0
API changes
- Many functions have been refactored to different modules; see the "Refactor" section for details.
compute.possible_complexesno longer includes the empty subsystem.- Made
is_cuta property. - Renamed
macro.list_all_partitionsandmacro.list_all_groupingstoall_partitionsandall_groupings. Both are now generators and return nested tuples instead of lists. - Moved
macro.make_mappingtoCoarseGrain.make_mapping. - Moved
macro.make_macro_tpmtoCoarseGrain.macro_tpm. - Added blackbox functionality to
macro.emergence. Blackboxing and coarse- graining are now parametrized with theblackboxandcoarse_grainarguments. - Removed
utils.submatrix. - Made
Network.tpmandNetwork.cmimmutable properties. - Removed the
purviewargument fromSubsystem.expand_repertoire. - Moved
validate.StateUnreachableErrorandmacro.ConditionallyDependentErrorto theexceptionsmodule. - Removed perturbation vector support.
- Changed
tpm.marginalize_outto take a list of indices. - Fixed
macro.effective_infoto use the algorithm from the macro-micro paper. - Replace
constants.DIRECTIONS,constants.PAST, andconstants.FUTUREwith a properEnumclass:constants.Direction. Past and future are now represented byconstants.Direction.PASTandconstants.Direction.FUTURE. - Simplifed logging config to use
config.LOG_STDOUT_LEVEL,config.LOG_FILE_LEVELandconfig.LOG_FILE. - Removed the
locationproperty ofConcept.
API Additions
- Added
subsystem.evaluate_partition. This returns the Ο for a particular partition. - Added
config.MEASUREto choose between EMD, KLD, or L1 for distance computations. - Added
macro.MacroSubsystem. This subclass ofSubsystemis used to performs macro computations. - Added
macro.CoarseGrainto represent coarse-grainings of a system. - Added
macro.Blackboxto represent system blackboxes. - Added
validate.blackboxandvalidate.coarse_grain. - Added
macro.all_coarse_grainsandmacro.all_blackboxesgenerators. - Added
Subsystem.cut_indicesproperty. - Added
Subsystem.cmconnectivity matrix alias. - Added
utils.all_states, a generator over all states of ann-element system. - Added
tpm.is_state_by_statefor testing whether a TPM is in state-by-state format. Networknow takes an optionalnode_labelsargument, allowing nodes to be referenced by a canonical name other than their indices. The nodes of aSubsystemcan now be specified by either their index or their label.- Added
models.normalize_constellationfor deterministically ordering a constellation. - Added a
Makefile. - Added an
exceptionsmodule. - Added
distribution.purviewfor computing the purview of a repertoire. - Added
distribution.repertoire_shape. - Added
config.PARTITION_TYPEto control the ways in which Ο-partitions are generated. - Added more functions to the
convertmodule:holi2loliandloli2holiconvert decimal indices between HOLI and LOLI formats.holi2loli_state_by_stateandloli2holi_state_by_stateconvert between HOLI and LOLI formats for state-by-state TPMs.- Added short aliases for some functions:
h2lisholi2lolil2hisloli2holil2sisloli_index2stateh2sisholi_index2states2hisstate2loli_indexs2lisstate2holi_indexh2l_sbsisholi2loli_state_by_statel2h_sbsisloli2holi_state_by_statesbn2sbsisstate_by_node2state_by_statesbs2sbnisstate_by_state2state_by_node
- Added the
Constellation.mechanisms,Constellation.labeled_mechanisms, andConstellation.phisproperties. - Add
BigMip.printmethod with optionalconstellationsargument that allows omitting the constellations.
Refactor
- Refactored the
utilsmodule into theconnectivity,distance,distribution,partition,timescale, andtpmmodules. - Existing macro coarse-grain logic to use
MacroSubsystemandCoarseGrain. - Improved string representations of PyPhi objects.
- Refactored JSON support. The
jsonifymodule now dumps PyPhi models to a a format which can be loaded to reproduce the full object graph of PyPhi objects. This causes backwards incompatible changes to the JSON format of some model representations. - Refactored
pyphi.configto be an object. Added validation and callbacks for config options.
Optimizations
- Added an analytic solution for the EMD computation between effect repertoires.
- Improved the time complexity of
directed_bipartition_of_onefrom exponential to linear.
Documentation
- Updated documentation and examples to reflect changes made to the
macroAPI and usage. - Added documentation pages for new modules.
- Python
Published by wmayner about 8 years ago
pyphi - 0.8.0
API changes
- Mechanisms and purviews are now passed to all functions and methods in node
index form (e.g.
(0, 1, 3)). Previously, many functions took these arguments asNodeobjects. Since nodes belong to a specificSubsystemit was possible to pass nodes from one subsystem to another subsystem's methods, leading to incorrect results. constellation_distanceno longer takes asubsystemargument because concepts in a constellation already reference their subsystems.- Moved
utils.cut_mechanism_indicesandutils.mechanism_split_by_cutto toCut.all_cut_mechanismsandCut.splits_mechanism, respectively; movedutils.cut_micetoMice.damaged_by_cut. Concept.__eq__: when comparing concepts for equality, we no longer directly check equality of their subsystems. Concept equality is now defined as follows:- Same Ο
- Same mechanism node indices cause/effect purview node indices
- Same mechanism state
- Same cause/effect repertoires
- Same networks This allows two concepts to be equal when e.g. the only difference between them is that one's subsystem is a superset of the other's subsystem.
Concept.__hash__: the above notion of concept equality is also implemented for concept hashing, so two concepts that differ only in that way will have the same hash value.- Disabled concept caching; removed the
config.CACHE_CONCEPTSoption.
API Additions
- Added
config.READABLE_REPRSto control whether__reprs__of PyPhi models default to using pretty string formatting. - Added a
Constellationobject. - Added
utils.submatrixandutils.relevant_connectionsfunctions. - Added the
macro.effective_infofunction. - Added the
utils.state_offunction. - Added the
Subsystem.proper_stateattribute. This is the state of the subsystem's nodes, rather than the entire network state. - Added an optional Redis-backed cache for Mice objects. This is enabled with
config.REDIS_CACHEand configured withconfig.REDIS_CONFIG. - Enabled parallel concept evaluation with
config.PARALLEL_CONCEPT_EVALUATION.
Fixes
Concept.eq_repertoiresno longer fails when the concept has no cause or effect.- Fixed the
Subsystem.proper_stateattribute.
Refactor
- Subsystem Mice and cause/effect repertoire caches; Network purview caches. Cache logic is now handled by decorators and custom cache objects.
- Block reducibility tests and Mice connection computations.
- Rich object comparisons on phi-objects.
Documentation
- Updated documentation and examples to reflect node-to-index conversion.
- Python
Published by rlmv about 10 years ago
pyphi - 0.7.1
Fixes
- Fixed a bug in
compute.constellation_distancewhere π from partitioned concepts was not allowed to move to the null concepts; it was assumed that the unpartitioned constellation would always have greater πΊπ. In some cases, the partitioned system will actually have greater πΊπ than the unpartitioned constellation, in which case some of that π needs to move to the null concept during the EMD calculation. This fix changes the distance matrix so that can happen.
- Python
Published by wmayner over 10 years ago
pyphi - 0.7.0
API additions
pyphi.macroprovides several functions to analyze networks over different spatial scales.convert.conditionally_independent(tpm)checks if a TPM is conditionally independent.
API changes
- π½ and π values are now rounded to
config.PRECISIONwhen stored on objects.
Fixes
- Tests for
Subsystem_find_mip_parallelandSubsystem_find_mip_sequential. - Slow tests for
compute.big_mip.
Refactor
- Subsystem cause and effect repertoire caching.
Documentation
- Added XOR and Macro examples.
- Python
Published by wmayner almost 11 years ago
pyphi - 0.6.0
Optimizations
- Pre-compute and cache possible purviews.
- Compute concept distance over least-common-purview rather than whole system.
- Store
relevant_connectionson MICE objects for MICE cache checking. - Only recheck concepts and cut mechanisms after a system cut.
API additions
- The new configuration option
CUT_ONE_APPROXIMATIONgives an approximation of π½ by only considering cuts that cut off a single node. - Formerly, the configuration was always printed when PyPhi was imported. Now
this can be suppressed by setting the
LOG_CONFIG_ON_IMPORToption tofalsein thepyphi_config.ymlfile.
Fixes
- Bipartition function.
- MICE caching.
- Python
Published by wmayner almost 11 years ago
pyphi - 0.5.0
Optimizations
- Concepts are only recomputed if they could have been changed by a cut.
- Cuts are evaluated individually, rather than in bidirectional pairs, which allows for better parallel performance.
API changes
- Removed the unused
validate.nodelistfunction.
API additions
- The new configuration option
ASSUME_CUTS_CANNOT_CREATE_NEW_CONCEPTSgives an approximation of π½ by only recomputing concepts that exist in the unpartitioned constellation. This is much faster in certain cases. - The methods used in determining whether a cut could effect a concept are
exposed via the
utilsmodule as:utils.cut_mechanism_indicesutils.cut_conceptsutils.uncut_concepts
- Added the
pyphi.Subsystem.connections_relevant_for_conceptmethod. - Added the
pyphi.Subsystem.cut_matrixproperty.
Fixes
pyphi.compute.main_complexnow returns an emptyBigMipif there are no proper complexes.- No longer using LRU-caches implemented as a circular, doubly-linked list;
this was causing a huge number of recursive calls when pickling a
Subsystemobject (since caches are stored on subsystems since v0.3.6) aspickletraversed the (potentially very large) cache. pyphi.json.make_encodablenow properly handles NumPy numeric types.
- Python
Published by wmayner almost 11 years ago
pyphi - 0.4.0
Optimizations
compute.big_mipis faster for reducible networks when executed in parallel; it returns immediately upon finding a reducible cut, rather than evaluating all cuts. NOTE: This introduces a race condition in cases where there is more than one reducible cut; there is no guarantee as to which cut will be found first and returned.compute.complexesprunes out subsystems that contain nodes without either inputs or outputs (any subsystem containing such a node must necessarily have zero π½).
API changes
compute.complexes: returns only irreducible MIPs; see optimizations.compute.big_mip- New race condition with cuts; see optimizations.
- The single-node and null
BigMip's constellations are now empty tuples instead of empty lists andNone, respectively.
models.Concept.eq_repertoiresno longer ensures that the networks of each concept are equal; it only checks if the repertoires are the same.
API additions
compute.all_complexesreturns theBigMipof every subsystem in the network's powerset (including reducible ones).compute.possible_main_complexesreturns the subsystems that survived the pruning described above.
Fixes
- Network tests.
Refactor
- Network attributes. They're now implemented as properties (with getters and setters) to facilitate changing them properly. It should be possible to use the same network object with different states.
- Network state validation.
utils.phi_eqis used wherever possible instead of direct comparisons toconstants.EPSILON.
- Python
Published by wmayner almost 11 years ago
pyphi - 0.3.8
- Choosing the minimal MIP in
pyphi.compute.big_mip is now more
deterministic.
- When comparing BigMips with > and <, the π½-values are compared only up
to config.PRECISION.
- BigMips are now truthy if their π½ is greater than or equal to
config.EPSILON (previously was strictly greater than).
- Python
Published by wmayner about 11 years ago
pyphi - 0.3.7
-
BigMips and Concepts now have their calculation time in the time
attribute. BigMips also have the attribute small_phi_time, which gives
the total time taken to calculate all concepts (not just the ones that
exist).
- If PARALLEL_CUT_EVALUATION is set to false, the cut evaluation will short-circuit as soon as a MIP of zero π½ is found.
- Fixed models._numpy_aware_eq, which failed when comparing two iterables where
one is a prefix of the other.
- Fixed models.Concept.location, which raised an error when the
concept's cause or effect was None.
- Python
Published by wmayner about 11 years ago
pyphi - 0.3.6
- LRU-caches for cause and effect repertoires are now local to the
Subsystem, improving memory performance, especially in cases where many different subsystems are being analyzed in the same script.
- Precomputed hamming matrices for up to 9 nodes are now distributed with the PyPhi package, rather than being computed every time. If you're working with more than 9 nodes, be sure to precompute the hamming matrices and add them to your PyPhi installation's data/hamming_matrices directory.
- Python
Published by wmayner about 11 years ago
pyphi - 0.3.4
Removed LRU caching on all pyphi.compute methods.
For long computations involving many networks, the compute module's caches
would begin to fill up the available memory, leaving no space for the much more
useful cause and effect repertoire caches.
This will be more comprehensively addressed in future releases.
- Python
Published by wmayner about 11 years ago
pyphi - First prerelease of PyPhi!
PyPhi implements logic for calculating Ξ¦ of a subsystem, and allows for inspection of all intermediate quantities and objects in the calculation.
Future releases will: - Provide methods for finding complexes - Include optimizations to make everything faster - Have up-to-date, improved documentation - Have a detailed section therein on how to get a proper Python development environment set up - Have near 100% test coverage
Note: it's highly likely that the dependencies won't resolve without a bit of fiddling. In particular, the code depends on my PyEMD project, which in turn depends on numpy such that it will not install unless numpy is already installed (normally you could just run pip install -r requirements.txt and all dependencies would install automatically, but in this case the installation of PyEMD will failβI aim to fix this in a future PyEMD release). Also, scipy must also be preinstalled. The upshot is that to get the dependencies, you need to run:
pip install numpy scipy && pip install -r requirements.txt
Also, the project uses Python 3, which you'll need to install and set up on your system (using virtualenv) if you haven't already.
Let me know if you need help getting everything to run, and enjoy! :smile_cat:
β Will
- Python
Published by wmayner almost 12 years ago