Metadata-Version: 2.4
Name: frm-miner
Version: 2.0
Summary: Mine Frequent Representative Motifs
Author-email: "Stijn J. Rotman" <s.j.rotman@uvt.nl>
License: MIT
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Intended Audience :: Science/Research
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy
Requires-Dist: scipy
Provides-Extra: test
Requires-Dist: pytest; extra == "test"
Provides-Extra: experiments
Requires-Dist: matplotlib; extra == "experiments"
Requires-Dist: opencv-python; extra == "experiments"
Requires-Dist: pillow; extra == "experiments"
Requires-Dist: stumpy; extra == "experiments"
Requires-Dist: setuptools; extra == "experiments"
Requires-Dist: pyscamp; extra == "experiments"
Requires-Dist: mass-ts; extra == "experiments"
Requires-Dist: tqdm; extra == "experiments"
Requires-Dist: yfinance; extra == "experiments"
Requires-Dist: fitdecode; extra == "experiments"
Requires-Dist: memory-profiler; extra == "experiments"
Dynamic: license-file

# FRM-Miner #

FRM-Miner: Efficient Motif Discovery in Large Collections of Time Series.

![Pipeline of FRM-Miner: A time series database is discretised into a sequence database using SAX. Non-overlapping frequent sequential patterns without gaps are mined, after which their occurrences are mapped back to the time series. The occurrences are then used to construct frequent representative motifs.](pipeline.png)

This repository contains the Python implementation of FRM-Miner (in `frm`), as well as code to replicate the experiments (in `experiments`).

# Installation

It is easiest to install FRM-Miner via pip:

```bash
pip install frm-miner
```

# Frm-Miner 1.0
Looking for the conference version (S. J. Rotman, B. Cule and L. Feremans, "Efficiently Mining Frequent Representative Motifs in Large Collections of Time Series," 2023 IEEE International Conference on Big Data (BigData), Sorrento, Italy, 2023, pp. 66-75, doi: 10.1109/BigData59044.2023.10386145.)?

[FRM-Miner 1.0](https://github.com/steenrotsman/frm-miner/tree/1.0)

# Example
You will probably get more meaningful results than this if you use your own data (collection of univariate time series, time series do not have to be equal length).
```
import numpy as np
import matplotlib.pyplot as plt  # Not a dependency

from frm import Miner

# Set hyperparameters
MINSUP = 0.3
SEGLEN = 5
ALPHA = 4
K = 4

# Generate 10 random time series with 100 observations each
rng = np.random.default_rng()
data = [rng.standard_normal(100) for _ in range(10)]

# Mine frequent representative motifs
miner = Miner(MINSUP, SEGLEN, ALPHA, k=K)
motifs = miner.mine(data)

# Plot frequent representative motifs
fig, axs = plt.subplots(ncols=K, sharey='all', layout='constrained')
for motif, ax in zip(motifs, axs):
    ax.plot(motif.representative)
plt.show()
```

