spmviz: mining and visualizing frequent sequences#
spmviz mines frequent sequences from event logs and shows them. It implements the network-based visualization of frequent sequences of Bántay and Abonyi (PLOS ONE, 2024) — the weighted extension network and the confidence- and transaction-based maps — and places it among nearly forty other views from data mining, visual analytics, process mining and sequence analysis. Five sequential pattern miners in pure Python, adapters to SPMF and other libraries, and export of every result to pandas, NetworkX, Gephi and Cytoscape make it a complete toolbox for event data.
PrefixSpan, SPAM, CM-SPAM, SPADE and GSP with gap, span and time constraints; closed, maximal and generator patterns; top-k; rules; episodes.
The weighted extension network (WN), the confidence (CM) and transaction (TM) maps of the 2024 paper, a fused map and pattern communities.
Prefix and pattern trees, sunbursts, icicles, LifeFlow, word and double trees, continuation-entropy and contrast trees.
Sankey diagrams, directly-follows graphs, MatrixWave, chord diagrams, growth Sankey, pattern-induced higher-order networks.
Seriated incidence and similarity matrices, grouped rule matrices, measure scatter plots, pattern landscapes, lattices, UpSet plots.
Index plots, chronograms, dotted charts, sequence logos, arc diagrams, episode timelines and MDL summaries.
pandas event logs, SPMF, XES, pm4py; NetworkX, GEXF (Gephi), GraphML, Cytoscape, igraph; plotly and pyvis figures.
The click-stream and alarm logs of the paper, textbook and everyday examples, generators, and the SPMF benchmark databases.
Mining and Visualizing Frequent Sequences in Python: methods, algorithms and every example of the gallery.
Quick start#
import spmviz as sv
db = sv.datasets.load_clickstream() # 343 sessions, 14 services
ps = sv.mine(db, min_support=0.01, max_gap=1, max_length=10)
ps.to_frame().head() # patterns, supports, confidences
sv.NBVFS("wn", start_items=[2]).fit(ps).plot() # weighted extension network
sv.NBVFS("tm").fit(ps).plot() # transaction-based map
sv.viz.plot_sunburst(db) # how the sessions begin
sv.predict_next(ps, [0, 1]) # what comes next