Metadata-Version: 2.5
Name: spmviz
Version: 1.0
Summary: Mining and visualization of frequent sequential patterns: network-based NBVFS maps, prefix trees, sunbursts, Sankey and transition diagrams, matrix views, lattices, sequence plots, MDL summaries and higher-order networks, with export to networkx, GEXF, GraphML, Cytoscape and SPMF.
Project-URL: Homepage, https://github.com/ComplexSystemsIntelligence/spmviz
Project-URL: Documentation, https://complexsystemsintelligence.github.io/spmviz
Project-URL: Repository, https://github.com/ComplexSystemsIntelligence/spmviz
Project-URL: Issues, https://github.com/ComplexSystemsIntelligence/spmviz/issues
Project-URL: Changelog, https://github.com/ComplexSystemsIntelligence/spmviz/blob/main/CHANGELOG.md
Project-URL: Book (PDF), https://complexsystemsintelligence.github.io/spmviz/spmviz-book.pdf
Author: László Bántay
Author-email: János Abonyi <janos@abonyilab.com>
License-Expression: MIT
License-File: LICENSE
Keywords: CM-SPAM,PrefixSpan,alarm management,clickstream,event sequences,frequent sequences,network visualization,process mining,sequential pattern mining,visualization
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
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: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Classifier: Topic :: Scientific/Engineering :: Visualization
Requires-Python: >=3.10
Requires-Dist: matplotlib>=3.7
Requires-Dist: networkx>=3.0
Requires-Dist: numpy>=1.24
Requires-Dist: pandas>=2.0
Requires-Dist: scipy>=1.11
Provides-Extra: all
Requires-Dist: gsppy>=3.0; extra == 'all'
Requires-Dist: igraph>=0.11; extra == 'all'
Requires-Dist: openpyxl>=3.1; extra == 'all'
Requires-Dist: plotly>=5.15; extra == 'all'
Requires-Dist: pm4py>=2.7; extra == 'all'
Requires-Dist: prefixspan>=0.5; extra == 'all'
Requires-Dist: pyvis>=0.3; extra == 'all'
Requires-Dist: scikit-learn>=1.3; extra == 'all'
Requires-Dist: seq2pat>=1.4; extra == 'all'
Provides-Extra: backends
Requires-Dist: gsppy>=3.0; extra == 'backends'
Requires-Dist: prefixspan>=0.5; extra == 'backends'
Requires-Dist: seq2pat>=1.4; extra == 'backends'
Provides-Extra: book
Requires-Dist: beautifulsoup4>=4.12; extra == 'book'
Requires-Dist: lxml; extra == 'book'
Requires-Dist: pillow; extra == 'book'
Requires-Dist: plotly>=5.15; extra == 'book'
Provides-Extra: dev
Requires-Dist: build; extra == 'dev'
Requires-Dist: gsppy>=3.0; extra == 'dev'
Requires-Dist: igraph>=0.11; extra == 'dev'
Requires-Dist: myst-parser; extra == 'dev'
Requires-Dist: numpydoc; extra == 'dev'
Requires-Dist: openpyxl>=3.1; extra == 'dev'
Requires-Dist: plotly>=5.15; extra == 'dev'
Requires-Dist: pm4py>=2.7; extra == 'dev'
Requires-Dist: prefixspan>=0.5; extra == 'dev'
Requires-Dist: pydata-sphinx-theme; extra == 'dev'
Requires-Dist: pytest-cov; extra == 'dev'
Requires-Dist: pytest>=7; extra == 'dev'
Requires-Dist: pyvis>=0.3; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Requires-Dist: scikit-learn>=1.3; extra == 'dev'
Requires-Dist: seq2pat>=1.4; extra == 'dev'
Requires-Dist: sphinx-copybutton; extra == 'dev'
Requires-Dist: sphinx-design; extra == 'dev'
Requires-Dist: sphinx-gallery>=0.15; extra == 'dev'
Requires-Dist: sphinx>=7; extra == 'dev'
Requires-Dist: twine; extra == 'dev'
Provides-Extra: docs
Requires-Dist: myst-parser; extra == 'docs'
Requires-Dist: numpydoc; extra == 'docs'
Requires-Dist: openpyxl>=3.1; extra == 'docs'
Requires-Dist: plotly>=5.15; extra == 'docs'
Requires-Dist: pydata-sphinx-theme; extra == 'docs'
Requires-Dist: scikit-learn>=1.3; extra == 'docs'
Requires-Dist: sphinx-copybutton; extra == 'docs'
Requires-Dist: sphinx-design; extra == 'docs'
Requires-Dist: sphinx-gallery>=0.15; extra == 'docs'
Requires-Dist: sphinx>=7; extra == 'docs'
Provides-Extra: interactive
Requires-Dist: plotly>=5.15; extra == 'interactive'
Requires-Dist: pyvis>=0.3; extra == 'interactive'
Provides-Extra: interop
Requires-Dist: igraph>=0.11; extra == 'interop'
Requires-Dist: openpyxl>=3.1; extra == 'interop'
Requires-Dist: pm4py>=2.7; extra == 'interop'
Provides-Extra: ml
Requires-Dist: scikit-learn>=1.3; extra == 'ml'
Provides-Extra: test
Requires-Dist: openpyxl>=3.1; extra == 'test'
Requires-Dist: pytest-cov; extra == 'test'
Requires-Dist: pytest>=7; extra == 'test'
Description-Content-Type: text/markdown

<p align="center"><img src="https://raw.githubusercontent.com/ComplexSystemsIntelligence/spmviz/main/docs/_static/banner.png" alt="spmviz: mining and visualizing frequent sequences in Python"></p>

# spmviz: mining and visualizing frequent sequences in Python

[![tests](https://github.com/ComplexSystemsIntelligence/spmviz/actions/workflows/ci.yml/badge.svg)](https://github.com/ComplexSystemsIntelligence/spmviz/actions/workflows/ci.yml)
[![docs](https://img.shields.io/badge/docs-gallery%20%2B%20API-285780)](https://complexsystemsintelligence.github.io/spmviz)
[![book](https://img.shields.io/badge/book-PDF%20%C2%B7%20EPUB%20%C2%B7%20web-D55E00)](https://complexsystemsintelligence.github.io/spmviz/book.html)
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/ComplexSystemsIntelligence/spmviz/blob/main/LICENSE)

**spmviz** mines frequent sequences from event logs — clicks, alarms, operator
actions, moves, daily activities — and shows them. It implements the
*network-based visualization of frequent sequences* of Bántay and Abonyi
([PLOS ONE 19(5): e0301262, 2024](https://doi.org/10.1371/journal.pone.0301262)):
the weighted extension network (NBVFS-WN) and the confidence- and transaction-based
maps (NBVFS-CM, NBVFS-TM). Around it the package collects nearly forty views from
data mining, visual analytics, process mining and social-science sequence analysis,
adds several new ones, and connects everything to the Python ecosystem.

| Module | Contents |
|---|---|
| `spmviz.data`, `spmviz.patterns` | `SequenceDatabase` (itemsets, timestamps, attributes, labels) and `PatternSet` (supports, supporting sequences, parents, confidences, closed/maximal/generator subsets, rules, incidence matrix) |
| `spmviz.mining` | PrefixSpan, SPAM, CM-SPAM, SPADE, GSP with gap, span and time constraints; top-k; sequential rules; WINEPI/MINEPI episodes |
| `spmviz.backends` | adapters to the `prefixspan`, `seq2pat` and `gsppy` packages and to the SPMF Java library |
| `spmviz.nbvfs` | the `NBVFS` estimator: WN, CM, TM and fused maps, with stress, NetworkX graph and file export |
| `spmviz.measures`, `spmviz.networks`, `spmviz.embedding` | interestingness measures, continuation entropy, group contrasts, similarities; extension networks, prefix trees, transition graphs, lattices, higher-order networks, pattern communities and sub-logs; SMACOF, similarity network fusion, landscapes |
| `spmviz.viz` | glyph tables, trees, sunbursts, icicles, LifeFlow, double trees, Sankey, DFG, MatrixWave, chord, growth Sankey, HON, incidence and similarity matrices, rule matrices, measure scatter, landscapes, lattices, UpSet, index plots, chronograms, dotted charts, sequence logos, arc diagrams, episodes, MDL covers, prediction, dashboard |
| `spmviz.interactive` | plotly sunbursts, icicles, treemaps, Sankey diagrams and maps; pyvis networks |
| `spmviz.summary`, `spmviz.predict` | MDL summaries; next-event prediction from the longest matching frequent sequence |
| `spmviz.io` | pandas event logs, SPMF, XES, pm4py; CSV, JSON, Excel; GEXF (Gephi), GraphML, GML, Cytoscape JSON, node-link JSON, DOT, Pajek, igraph |
| `spmviz.datasets` | the click-stream (BPI Challenge 2016) and alarm logs of the paper, textbook databases, melodies, chess openings, generators, nine SPMF benchmark databases |

## Installation

```bash
pip install spmviz
```

Python ≥ 3.10; depends on numpy, scipy, networkx, pandas and matplotlib.
`pip install "spmviz[all]"` adds plotly, pyvis, igraph, openpyxl, pm4py and the
external miners.

## Quick start

```python
import spmviz as sv
from spmviz.viz import plot_sunburst, plot_prefix_tree

db = sv.datasets.load_clickstream()                       # 343 sessions, 14 services
ps = sv.mine(db, min_support=0.01, max_gap=1, max_length=10)
print(ps)                                                 # 241 frequent sequences
ps.to_frame().head()                                      # supports, confidences, lift, ...

sv.NBVFS("wn", start_items=[2]).fit(ps).plot()            # weighted extension network
sv.NBVFS("cm").fit(ps).plot()                             # confidence-based map
sv.NBVFS("tm").fit(ps).write("clickstream_tm.gexf")       # for Gephi

plot_sunburst(db)                                         # how the sessions begin
plot_prefix_tree(db, color_by="entropy")                  # where the next step is uncertain
sv.predict_next(ps, [0, 1])                               # what comes next
```

## Documentation and book

* Documentation, gallery of 36 runnable examples and API reference:
  <https://complexsystemsintelligence.github.io/spmviz>
* The companion book, *Mining and Visualizing Frequent Sequences in Python: The
  spmviz toolbox* (CC BY 4.0): [PDF](https://complexsystemsintelligence.github.io/spmviz/spmviz-book.pdf),
  [EPUB](https://complexsystemsintelligence.github.io/spmviz/spmviz-book.epub),
  [web edition](https://complexsystemsintelligence.github.io/spmviz/book/index.html)

## Citing

Please cite the toolbox and the original NBVFS paper (see `CITATION.cff`):

> J. Abonyi, L. Bántay, *spmviz: mining and visualizing frequent sequences in Python*, version 1.0, 2026.
>
> L. Bántay, J. Abonyi, Network-based visualisation of frequent sequences, *PLOS ONE* 19(5) (2024) e0301262, doi:10.1371/journal.pone.0301262.

## Acknowledgments

Developed at the University of Pannonia, Veszprém, by the
[Complex Systems Intelligence](https://complexsystemsintelligence.github.io) group
([abonyilab.com](https://www.abonyilab.com)). The research was supported by the
National Research, Development and Innovation Office of Hungary (NKFIH) through the
OTKA 143482 project.

## License

MIT for the software; CC BY 4.0 for the book.
