{ "info": { "author": "Szymon Talaga", "author_email": "", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: Implementation :: PyPy" ], "description": "=============================================================\nPyBDM: Python interface to the *Block Decomposition Method*\n=============================================================\n\n.. image:: https://badge.fury.io/py/pybdm.png\n :target: http://badge.fury.io/py/pybdm\n\n.. image:: https://travis-ci.org/sztal/pybdm.svg?branch=master\n :target: https://travis-ci.org/sztal/pybdm\n\n.. image:: https://codecov.io/gh/sztal/pybdm/branch/master/graph/badge.svg?branch=master\n :target: https://codecov.io/gh/sztal/pybdm\n\n.. image:: https://readthedocs.org/projects/pybdm-docs/badge/?version=latest\n :target: https://pybdm-docs.readthedocs.io/en/latest/?badge=latest\n :alt: Documentation Status\n\nThe Block Decomposition Method (BDM) approximates algorithmic complexity\nof a dataset of arbitrary size, that is, the length of the shortest computer\nprogram that generates it. This is not trivial as algorithmic complexity\nis not a computable quantity in the general case and estimation of\nalgorithmic complexity of a dataset can be very useful as it points to\nmechanistic connections between elements of a system, even such that\ndo not yield any regular statistical patterns that can be captured with\nmore traditional tools based on probability theory and information theory.\n\nCurrently 1D and 2D binary arrays are supported, as well as 1D arrays\nwith 4, 5, 6 and 9 discrete symbols.\n\nBDM and the necessary parts of the algorithmic information theory\nit is based on are described in `this article `_.\n\nSee the official documentation_ for more information.\n\n\nInstallation\n============\n\nStandard installation (stable)::\n\n pip install pybdm\n\nDevelopment version installation::\n\n pip install git+https://github.com/sztal/pybdm.git\n\nLocal development::\n\n git clone https://github.com/sztal/pybdm\n cd pybdm\n pip install --editable .\n\n\nSupported versions\n------------------\n\nPython3.5+ is supported. Tests are run against Linux, but\nWindows and OSX should work as well.\n\n\nUsage\n=====\n\nThe BDM is implemented using the object-oriented approach and expects\ninput represented as `Numpy `__ arrays of integer type.\n\n.. highlights::\n\n ``BDM`` objects operate exclusively on **integer arrays**.\n Hence, any alphabet must be first mapped to a set of integers ranging\n from ``0`` to ``k``.\n\nDetailed usage examples can be found in the official documentation_.\n\n\nBinary sequences (1D)\n---------------------\n\n.. code-block:: python\n\n import numpy as np\n from pybdm import BDM\n\n # Create a dataset (must be of integer type)\n X = np.ones((100,), dtype=int)\n\n # Initialize BDM object\n # ndim argument specifies dimensionality of BDM\n bdm = BDM(ndim=1)\n\n # Compute BDM\n bdm.bdm(X)\n\n # BDM objects may also compute standard Shannon entropy in base 2\n bdm.ent(X)\n\n\nBinary matrices (2D)\n--------------------\n\n.. code-block:: python\n\n import numpy as np\n from pybdm import BDM\n\n # Create a dataset (must be of integer type)\n X = np.ones((100, 100), dtype=int)\n\n # Initialize BDM object\n bdm = BDM(ndim=2)\n\n # Compute BDM\n bdm.bdm(X)\n\n # BDM objects may also compute standard Shannon entropy in base 2\n bdm.ent(X)\n\nNon-binary sequences (1D)\n-------------------------\n\n.. code-block:: python\n\n import numpy as np\n from pybdm import BDM\n\n # Create a dataset (4 discrete symbols)\n np.random.seed(303)\n X = np.random.randint(0, 4, (100,))\n\n # Initialize BDM object with 4-symbols alphabet\n bdm = BDM(ndim=1, nsymbols=4)\n\n # Compute BDM\n bdm.bdm(X)\n\n\n\nParallel processing\n-------------------\n\n*PyBDM* was designed with parallel processing in mind.\nUsing modern packages for parallelization such as\n`joblib `__\nmakes it really easy to compute BDM for massive objects.\n\nIn this example we will slice a 1000x1000 dataset into 200x200 pieces\ncompute so-called counter objects (final BDM computation operates on such objects)\nin parallel in 4 independent processes, and aggregate the results\ninto a single BDM approximation of the algorithmic complexity of the dataset.\n\n.. highlights::\n\n Remember that data has to be sliced correctly during parallelization\n in order to ensure fully correct BDM computations. That is, all slices\n except lower and right boundaries have to be decomposable without\n any boundary leftovers by the selected decomposition algorithm.\n\n.. code-block:: python\n\n import numpy as np\n from joblib import Parallel, delayed\n from pybdm import BDM\n from pybdm.utils import decompose_dataset\n\n # Create a dataset (must be of integer type)\n X = np.ones((1000, 1000), dtype=int)\n\n # Initialize BDM object\n bdm = BDM(ndim=2)\n\n # Compute counter objects in parallel\n counters = Parallel(n_jobs=4) \\\n (delayed(bdm.decompose_and_count)(d) for d in decompose_dataset(X, (200, 200)))\n\n # Compute BDM\n bdm.compute_bdm(*counters)\n\n\nPerturbation analysis\n---------------------\n\nBesides the main *Block Decomposition Method* implementation *PyBDM* provides\nalso an efficient algorithm for perturbation analysis based on *BDM*\n(or standard Shannon entropy).\n\nA perturbation experiment studies change of *BDM* / entropy under changes\napplied to the underlying dataset. This is the main tool for detecting\nparts of a system having some causal significance as opposed\nto noise parts.\n\nParts which after yield negative contribution to the overall\ncomplexity after change are likely to be important for the system,\nsince their removal make it more noisy. On the other hand parts that yield\npositive contribution to the overall complexity after change are likely\nto be noise since they extend the system's description length.\n\n.. code-block:: python\n\n import numpy as np\n from pybdm import BDM\n from pybdm.algorithms import PerturbationExperiment\n\n # Create a dataset (must be of integer type)\n X = np.ones((100, 100), dtype=int)\n\n # Initialize BDM object\n bdm = BDM(ndim=2)\n\n # Initialize perturbation experiment object\n # (may be run for both bdm or entropy)\n perturbation = PerturbationExperiment(bdm, X, metric='bdm')\n\n # Compute BDM change for all data points\n delta_bdm = perturbation.run()\n\n # Compute BDM change for selected data points and keep the changes while running\n # One array provide indices of elements that are to be change.\n idx = np.array([[0, 0], [10, 10]], dtype=int)\n # Another array provide new values to assign.\n # Negative values mean that new values will be selected\n # randomly from the set of other possible values from the alphabet.\n values = np.array([-1, -1], dtype=int)\n delta_bdm = perturbation.run(idx, values, keep_changes=True)\n\n\nAuthors & Contact\n=================\n\n* Szymon Talaga \n* Kostas Tsampourakis \n\n\n.. _documentation: http://pybdm-docs.rtfd.org\n\n\n\nDocumentation\n-------------\n\nThe full documentation is at http://pybdm-docs.rtfd.org.\n\n\n\nHistory\n-------\n\n0.1.0 (2019-09-22)\n++++++++++++++++++\n\n* First release on PyPI.\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/sztal/pybdm", "keywords": "bdm,ctm,aid,algorithmic information,algorithmic information dynamics,algorithmic complexity,kolmogorov complexity,k-complexity,description length,block decomposition method,coding theorem method,algorithmic information theory", "license": "MIT", "maintainer": "Szymon Talaga", "maintainer_email": "stalaga@protonmail.com", "name": "pybdm", "package_url": "https://pypi.org/project/pybdm/", "platform": "", "project_url": "https://pypi.org/project/pybdm/", "project_urls": { "Homepage": "https://github.com/sztal/pybdm" }, "release_url": "https://pypi.org/project/pybdm/0.1.0/", "requires_dist": [ "numpy (>=1.15.4)" ], "requires_python": "", "summary": "Python implementation of block decomposition method for approximating algorithmic complexity.", "version": "0.1.0" }, "last_serial": 5869427, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "9d181c541f5a56286c93ce3f2e38e58f", "sha256": "28cec2b7263f4448ef9d62ae71bf84d1450b83d8a160a69779be0022959ce3c1" }, "downloads": -1, "filename": "pybdm-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "9d181c541f5a56286c93ce3f2e38e58f", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 39936085, "upload_time": "2019-09-22T15:12:28", "url": "https://files.pythonhosted.org/packages/b7/32/fd74c068e07e1b91a732982125bd821af9fb144cd741d16ac0a607564538/pybdm-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b15b64aa1a5b077e345195fafcca837b", "sha256": "16d4a3b12ddd506bc7d94b41e19da53e4d448f6670384c41e5c24cf2f71b622c" }, "downloads": -1, "filename": "pybdm-0.1.0.tar.gz", "has_sig": false, "md5_digest": "b15b64aa1a5b077e345195fafcca837b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 39942776, "upload_time": "2019-09-22T15:13:02", "url": "https://files.pythonhosted.org/packages/ba/63/cf3fee7f8a86b1f289ded34340fa2c8c2fd0ca6a231dada486002a17495b/pybdm-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "9d181c541f5a56286c93ce3f2e38e58f", "sha256": "28cec2b7263f4448ef9d62ae71bf84d1450b83d8a160a69779be0022959ce3c1" }, "downloads": -1, "filename": "pybdm-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "9d181c541f5a56286c93ce3f2e38e58f", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 39936085, "upload_time": "2019-09-22T15:12:28", "url": "https://files.pythonhosted.org/packages/b7/32/fd74c068e07e1b91a732982125bd821af9fb144cd741d16ac0a607564538/pybdm-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b15b64aa1a5b077e345195fafcca837b", "sha256": "16d4a3b12ddd506bc7d94b41e19da53e4d448f6670384c41e5c24cf2f71b622c" }, "downloads": -1, "filename": "pybdm-0.1.0.tar.gz", "has_sig": false, "md5_digest": "b15b64aa1a5b077e345195fafcca837b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 39942776, "upload_time": "2019-09-22T15:13:02", "url": "https://files.pythonhosted.org/packages/ba/63/cf3fee7f8a86b1f289ded34340fa2c8c2fd0ca6a231dada486002a17495b/pybdm-0.1.0.tar.gz" } ] }