Skip to main content

mfn

Implementation in Python of the MFN method to measure complexity & entropy of time series. This is useful if you need features for a model such as Porfolio Optimization, clustering of time series, etc. This method is the implementation of the paper Scientific progress in information theory quantifiers. (Chaos, Solitons & Fractals, 170, 113260., Martins, A. M. F., Fernandes, L. H. S., & Nascimento, A. D. C. (2023).)

Installation

pip install mfn

or using Poetry

poetry add mfn

Usage

import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from mfn.entropy import MFN

## Generating a time series with trend and noise.
time_series = np.arange(0, 100, 1)
time_series = time_series + np.random.normal(0, 10, size=len(time_series))

value_dict = MFN(
    time_series,
    b=10,
    B=.1,
    size=100,
    dx=3
)

f, ax = plt.subplots(figsize=(6, 6))
value_df = pd.DataFrame(value_dict).reset_index()
value_df = value_df.melt(id_vars='index', value_vars=value_df.columns[1:])
sns.barplot(value_df, x='variable', y='value', errorbar="sd")
plt.title("MFN method results")
f.tight_layout()
plt.show()

Release files for mfn 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mfn 0.1.0
File Size Uploaded
mfn-0.1.0.tar.gz 4.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mfn 0.1.0
File Interpreter ABI Platform
mfn-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.7 kB

Release files / mfn-0.1.0.tar.gz

Download URL mfn-0.1.0.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2b756e77add9bde3ea20f43643cde4130374fbc9aed033ac88ca1990ef06e27b
BLAKE2b-256 checksum
How to use checksums
550eaab23696606ee6cc015b368601812b2ab243373099d50a0b43b620b477e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.10.7 Darwin/23.0.0

Release files / mfn-0.1.0-py3-none-any.whl

Download URL mfn-0.1.0-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6b4342be2b9b739176a6981cf982f380d21259b8c91484c68692abd4a3ab72e3
BLAKE2b-256 checksum
How to use checksums
2e7e89d1fa490f58a744c5e04240718c8f291f164c3b26e9256f0da090f7fe72
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.10.7 Darwin/23.0.0

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page