Skip to main content

Statistical Significance Criteria for Multivariate Time Series Motifs

Project description

MSig

Statistical Significance Testing for Multivariate Time Series Motifs

MSig evaluates whether discovered motifs occur more frequently than expected by chance, using rigorous statistical methods.

Installation

Using uv (recommended)

# Clone the repository
git clone https://github.com/MiguelGarcaoSilva/msig.git
cd msig

# Sync dependencies (includes STUMPY and LAMA)
uv sync

# Optional: Install MOMENTI (for MOMENTI experiments - Linux/Windows only)
uv pip install git+https://github.com/aidaLabDEI/MOMENTI-motifs

Note: MOMENTI has platform-specific dependencies and may not install on macOS.

Using pip

# Clone repository
git clone https://github.com/MiguelGarcaoSilva/msig.git
cd msig

# Install with experiment dependencies (includes STUMPY, LAMA, and MOMENTI)
pip install -e ".[experiments]"

# Or install dependencies manually
pip install -e .
pip install stumpy  # For STUMPY experiments
pip install leitmotif  # For LAMA experiments
pip install git+https://github.com/aidaLabDEI/MOMENTI-motifs  # For MOMENTI experiments

Quick Start

from msig import Motif, NullModel
import numpy as np

# Your multivariate time series (m variables × n time points)
data = np.array([...])

# Create null model
model = NullModel(data, dtypes=[float, float], model="empirical")

# Test motif significance
motif = Motif(pattern, variables, thresholds, n_matches)
probability = motif.set_pattern_probability(model, vars_indep=True)
pvalue = motif.set_significance(max_possible_matches, n_variables)

print(f"p-value: {pvalue:.2e}")

See the examples/ folder for complete examples (simple_example.py and example.ipynb).

Running Experiments

The repository includes case studies on three datasets with three discovery methods (STUMPY, LAMA, MOMENTI):

# Run individual experiments
uv run python experiments/audio/run_stumpy.py
uv run python experiments/audio/run_lama.py
uv run python experiments/audio/run_momenti.py

uv run python experiments/populationdensity/run_stumpy.py
uv run python experiments/populationdensity/run_lama.py
uv run python experiments/populationdensity/run_momenti.py

uv run python experiments/washingmachine/run_stumpy.py
uv run python experiments/washingmachine/run_lama.py
uv run python experiments/washingmachine/run_momenti.py

Results are saved to results/<dataset>/<method>/.

Citation

@article{silva2024msig,
  title={On Why and How Statistical Significance Criteria Can Guide Multivariate Time Series Motif Analysis},
  author={Silva, Miguel G. and Henriques, Rui and Madeira, Sara C.},
  year={2024}
}

License

MIT License - see LICENSE file.

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

msig-0.1.2.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

msig-0.1.2-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file msig-0.1.2.tar.gz.

File metadata

  • Download URL: msig-0.1.2.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.21

File hashes

Hashes for msig-0.1.2.tar.gz
Algorithm Hash digest
SHA256 20645b83a74e952b522b08fd76bae9e4db3e386677a9302d4804a0d4259a7dcb
MD5 3a5728554e0efa397a4a5967f4458587
BLAKE2b-256 995e2030861d95a9b9178f9cf0409ae5e540c3e1ae95f7a284d16b221f30b1a9

See more details on using hashes here.

File details

Details for the file msig-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: msig-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.21

File hashes

Hashes for msig-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f9fd255469a1c644c150ff338e95054d9bea9e119421cfac2000510aeed7a52f
MD5 7c86363732a9420c2488000f6a17fc12
BLAKE2b-256 fc7381d11b0b05d008bb603a1bef0d1071c7c61a499e475f2b484209f0c00354

See more details on using hashes here.

Supported by

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