Skip to main content

A Python package for data analysis with multivariate permutation entropy

Project description

mpePy: A Python Package for Data Analysis with Multivariate Permutation Entropy for Time Series

mpepy is a pure Python module that implements data analysis methods based on Bandt and Pompe’s [1] symbolic encoding scheme.

mpepy implements the following data analysis methods:

  • Pooled Permutation Entropy [#keller_lauffer];

  • Multivariate Multiscale Permutation Entropy [#morabito];

  • Multivariate Weighted Permutation Entropy [4];

  • Multivariate Ordinal Pattern Permutation Entropy [2];

  • Multivariate Permutation Entropy based on Principal Component Analysis [2]

Installing

mpePy can be installed via the command line using

pip install mpepy

or you can directly clone its git repository:

git clone https://github.com/marisamohr/mpePy.git
cd mpepy
pip install -e .

Basic usage

# Computing different multivariate permutation entropies for fractional Brownian motion.

import subprocess
import csv
import pandas as pd
import mpepy


# Example of data simulation: multivariate fractional Brownian motion
# usage of R-package
def simulateMultiFracBrownMotion(n, H_1, H_2, H_3, H_4, H_5, rho):
    output_file_name = './intermediate_output/MultiFracBrownMotionOutput.csv'
    subprocess.check_call(['Rscript', './intermediate_output/simulation_mfBm.R', str(n), str(H_1), str(H_2), str(H_3), str(H_4), str(H_5), str(rho), output_file_name], shell=False)
    arr = []
    with open(output_file_name, 'r') as file:
        reader = csv.reader(file)
        for row in reader:
            arr.append(row)
    mfbm = pd.DataFrame.from_records(arr)
    mfbm = mfbm.apply(pd.to_numeric)
    return mfbm
# simulation
mfbm = simulateMultiFracBrownMotion(2000, 0.3, 0.6, None, None, None, 0.0)
mfbm = mfbm.T


# Examples of multivariate permutation entropy calculation
mpe.pooled_permutation_entropy(mfbm, order = 3 , delay = 1)
mpe.multivariate_weighted_permutation_entropy(mfbm, order = 3 , delay = 1)
mpe.multivariate_multiscale_permutation_entropy(mfbm, order = 3 , delay = 1, scale = 1)
mpe.multivariate_ordinal_pattern_permutation_entropy(mfbm, order = 2 , delay = 1)
mpe.multivariate_permutation_entropy_pca(mfbm, order = 2 , delay = 1, no_pc = 1)
mpe.multivariate_permutation_entropy_pca(mfbm, order = 3 , delay = 5, no_pc = "all")

Contributors

References

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mpePy-0.0.1.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

mpePy-0.0.1-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file mpePy-0.0.1.tar.gz.

File metadata

  • Download URL: mpePy-0.0.1.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.7.5

File hashes

Hashes for mpePy-0.0.1.tar.gz
Algorithm Hash digest
SHA256 a77d0776e18b9197a1216d2661908b568481fc04584fcc1b7a7b9bd72037a2d8
MD5 86c8441a108ddc2f73202f00f8dca2c9
BLAKE2b-256 3e27c7ad4e2bc34b79ca95b40179fc5ccadb575d6a0d6184b4018957bfc7eeb7

See more details on using hashes here.

Provenance

File details

Details for the file mpePy-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: mpePy-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.7.5

File hashes

Hashes for mpePy-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 11794e8dcbb85c9eef219f4d47f866c02e2ad7ed56ee290fbcb6c32a81dcf7f7
MD5 1973fc4e7c7e7404c90c779c32a152b5
BLAKE2b-256 7b7f5d43b31c988e2cee7b6c701147a3d8d122303d2e03e2f92cf4792c623ba0

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page