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 [2];

  • Multivariate Multiscale Permutation Entropy [3];

  • Multivariate Weighted Permutation Entropy [4];

  • Multivariate Ordinal Pattern Permutation Entropy [5];

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

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 as mpe


# 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.2.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: mpePy-0.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 0cb9f911962032636aced4d78e52b9cd90c2573ad4117a9cec7217776912d9e4
MD5 ed564dd82ab4c8cba6159fad1ce2fd83
BLAKE2b-256 07c4ee9ca106b89a3870d85bba3a00f9ea0e41041491a69aefb3ba63f8d4867f

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: mpePy-0.0.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 dd7f79b2c5daf3412f9a28de0cc2cb2a151bd2a6f87161134aebce86b27533f0
MD5 ef9a383e8d4f26fbe7a0d810ad7efe14
BLAKE2b-256 dbffdee63d161a5d51459f40e26ec410b231a5d811ba3339725f152f40600507

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