-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Set version to 0.0.1 * Integrate class docstrings for BDM variants * Add some defensing programming and tests for BDM initialization * Start documentation process * Add tests for probability normalization in D1 and commented in D2 (D2 does not pass probably since the 2D ruleset is much bigger and is not entirely covered with small dataset parts) * Add docstrings to theory tests * Minor fix * Remove nbdm and nent methods; use normalize flag in the main bdm and ent methods instead * Add better data checks to bdm and ent methods (controlled by 'normalize' flag) * Implement functions for iterating over slices and datasets parts in an easy manner * Reimplement normalized bdm/ent so it has lower memory footprint and is slightly faster (no need for calling partition method on artifical datasets) * Raise NotImplementedError in normalized bdm/ent for BDMBase with positive shift * Add preliminary version of documentation * Use version 0.1.0 * Implement partition algorithm classes + simplify slicing utils * BDM class reimplemented * Rename boundary attribute in the BDM class to partition and rename partition method to decompose (both in BDM and Partition classes) * Start rewriting the docs * Add global package options * Rename the package to pybdm * Fix docs * Add docs + minor changes in perturbation experiment * Main docs finish / module docs are yet to be done * Fix BDM docs + add slight API changes * Finish docs * Change history and minor fixes in the docs * Add separate requirements for sphinx builds * Add docs status badges * Minor changes to the docs * Add tests for multiplt OS on Travis CI * Run Travis tests only agains linux and osx * Remove tox-conda from requirements.txt * Simplify travis config * Minor fixes * Remove tests for OSX
- Loading branch information
Showing
58 changed files
with
2,353 additions
and
1,194 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,40 @@ | ||
# Config file for automatic testing at travis-ci.org | ||
dist: bionic | ||
language: python | ||
|
||
dist: bionic | ||
python: | ||
- "3.7" | ||
- "3.6" | ||
# - "3.5" | ||
- 3.5 | ||
- 3.6 | ||
- 3.7 | ||
|
||
# command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors | ||
install: | ||
- pip install -r requirements.txt | ||
- pip install . | ||
|
||
# matrix: | ||
# include: | ||
# - os: osx | ||
# language: minimal | ||
# python: 3.7 | ||
# install: | ||
# - pip3 install -r requirements.txt | ||
# - pip3 install -e .[tests] | ||
# script: | ||
# - pytest --slow | ||
# - os: windows | ||
# language: minimal | ||
# python: | ||
# - "3.5" | ||
# - "3.6" | ||
# - "3.7" | ||
# before_install: | ||
# - choco install python3 | ||
# - export PATH="/c/Python37:/c/Python37/Scripts:$PATH" | ||
|
||
# command to run tests, e.g. python setup.py test | ||
script: | ||
- pytest --slow --cov-report term --cov=bdm/ --cov=test/ | ||
- pytest --slow --cov-report term --cov=pybdm/ --cov=tests/ | ||
- pytest --pylint -m pylint | ||
|
||
after_success: | ||
- codecov |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,12 +2,17 @@ | |
Authors | ||
======= | ||
|
||
Core Team | ||
--------- | ||
Core Team (AlgoDyn Development Team) | ||
------------------------------------ | ||
|
||
* Szymon Talaga <[email protected]> | ||
* Kostas Tsampourakis <[email protected]> | ||
|
||
Maintainer | ||
---------- | ||
|
||
* Szymon Talaga <[email protected]> | ||
|
||
Contributors | ||
------------ | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
History | ||
------- | ||
|
||
0.0.0 (2019-01-01) | ||
0.1.0 (2019-09-22) | ||
++++++++++++++++++ | ||
|
||
* First release on PyPI. |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
============================================================= | ||
PyBDM: Python interface to the *Block Deincomposition Method* | ||
PyBDM: Python interface to the *Block Decomposition Method* | ||
============================================================= | ||
|
||
.. image:: https://badge.fury.io/py/pybdm.png | ||
|
@@ -11,6 +11,10 @@ PyBDM: Python interface to the *Block Deincomposition Method* | |
.. image:: https://codecov.io/gh/sztal/pybdm/branch/master/graph/badge.svg?branch=master | ||
:target: https://codecov.io/gh/sztal/pybdm | ||
|
||
.. image:: https://readthedocs.org/projects/pybdm-docs/badge/?version=latest | ||
:target: https://pybdm-docs.readthedocs.io/en/latest/?badge=latest | ||
:alt: Documentation Status | ||
|
||
The Block Decomposition Method (BDM) approximates algorithmic complexity | ||
of a dataset of arbitrary size, that is, the length of the shortest computer | ||
program that generates it. This is not trivial as algorithmic complexity | ||
|
@@ -20,28 +24,38 @@ mechanistic connections between elements of a system, even such that | |
do not yield any regular statistical patterns that can be captured with | ||
more traditional tools based on probability theory and information theory. | ||
|
||
Currently 1D and 2D binary arrays are supported, but this may be extended to higher dimensionalities and more complex alphabets in the future. | ||
Currently 1D and 2D binary arrays are supported, as well as 1D arrays | ||
with 4, 5, 6 and 9 discrete symbols. | ||
|
||
BDM and the necessary parts of the algorithmic information theory | ||
it is based on are described in `this paper <https://www.mdpi.com/1099-4300/20/8/605>`__. | ||
it is based on are described in `this article <https://www.mdpi.com/1099-4300/20/8/605>`_. | ||
|
||
See the official documentation_ for more information. | ||
|
||
|
||
Installation | ||
============ | ||
|
||
Standard installation (stable):: | ||
|
||
pip install pybdm | ||
|
||
Development version installation:: | ||
|
||
pip install git+https://github.com/sztal/pybdm.git | ||
|
||
Local development:: | ||
|
||
git clone https://github.com/sztal/pybdm | ||
cd pybdm | ||
pip install --editable . | ||
|
||
Development version installation:: | ||
|
||
pip install git+https://github.com/sztal/pybdm.git | ||
|
||
Standard installation (not yet on *PyPI*):: | ||
Supported versions | ||
------------------ | ||
|
||
pip install bdm | ||
Python3.5+ is supported. Tests are run against Linux, but | ||
Windows and OSX should work as well. | ||
|
||
|
||
Usage | ||
|
@@ -56,14 +70,16 @@ input represented as `Numpy <http://www.numpy.org/>`__ arrays of integer type. | |
Hence, any alphabet must be first mapped to a set of integers ranging | ||
from ``0`` to ``k``. | ||
|
||
Detailed usage examples can be found in the official documentation_. | ||
|
||
|
||
Binary sequences (1D) | ||
--------------------- | ||
|
||
.. code-block:: python | ||
import numpy as np | ||
from bdm import BDM | ||
from pybdm import BDM | ||
# Create a dataset (must be of integer type) | ||
X = np.ones((100,), dtype=int) | ||
|
@@ -85,7 +101,7 @@ Binary matrices (2D) | |
.. code-block:: python | ||
import numpy as np | ||
from bdm import BDM | ||
from pybdm import BDM | ||
# Create a dataset (must be of integer type) | ||
X = np.ones((100, 100), dtype=int) | ||
|
@@ -99,6 +115,25 @@ Binary matrices (2D) | |
# BDM objects may also compute standard Shannon entropy in base 2 | ||
bdm.ent(X) | ||
Non-binary sequences (1D) | ||
------------------------- | ||
|
||
.. code-block:: python | ||
import numpy as np | ||
from pybdm import BDM | ||
# Create a dataset (4 discrete symbols) | ||
np.random.seed(303) | ||
X = np.random.randint(0, 4, (100,)) | ||
# Initialize BDM object with 4-symbols alphabet | ||
bdm = BDM(ndim=1, nsymbols=4) | ||
# Compute BDM | ||
bdm.bdm(X) | ||
Parallel processing | ||
------------------- | ||
|
@@ -113,22 +148,29 @@ compute so-called counter objects (final BDM computation operates on such object | |
in parallel in 4 independent processes, and aggregate the results | ||
into a single BDM approximation of the algorithmic complexity of the dataset. | ||
|
||
.. highlights:: | ||
|
||
Remember that data has to be sliced correctly during parallelization | ||
in order to ensure fully correct BDM computations. That is, all slices | ||
except lower and right boundaries have to be decomposable without | ||
any boundary leftovers by the selected decomposition algorithm. | ||
|
||
.. code-block:: python | ||
import numpy as np | ||
from joblib import Parallel, delayed | ||
from bdm import BDM | ||
from bdm.utils import slice_dataset | ||
from pybdm import BDM | ||
from pybdm.utils import decompose_dataset | ||
# Create a dataset (must be of integer type) | ||
X = np.ones((1000, 1000), dtype=int) | ||
# Initialize BDM object | ||
BDM = bdm(ndim=2) | ||
bdm = BDM(ndim=2) | ||
# Compute counter objects in parallel | ||
counters = Parallel(n_jobs=4) \ | ||
(delayed(bdm.lookup_and_count)(d) for d in slice_dataset(X, (200, 200))) | ||
(delayed(bdm.decompose_and_count)(d) for d in decompose_dataset(X, (200, 200))) | ||
# Compute BDM | ||
bdm.compute_bdm(*counters) | ||
|
@@ -155,14 +197,14 @@ to be noise since they extend the system's description length. | |
.. code-block:: python | ||
import numpy as np | ||
from bdm import BDM | ||
from bdm.algorithms import PerturbationExperiment | ||
from pybdm import BDM | ||
from pybdm.algorithms import PerturbationExperiment | ||
# Create a dataset (must be of integer type) | ||
X = np.ones((100, 100), dtype=int) | ||
# Initialize BDM object | ||
BDM = bdm(ndim=2) | ||
bdm = BDM(ndim=2) | ||
# Initialize perturbation experiment object | ||
# (may be run for both bdm or entropy) | ||
|
@@ -186,3 +228,6 @@ Authors & Contact | |
|
||
* Szymon Talaga <[email protected]> | ||
* Kostas Tsampourakis <[email protected]> | ||
|
||
|
||
.. _documentation: http://pybdm-docs.rtfd.org |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.