Note
Go to the end to download the full example code or to run this example in your browser via Binder.
Lattices and UpSet plots#
The frequent patterns are ordered by containment: the Hasse diagram draws an edge from every pattern to its one-item super-patterns, one row per length, closed patterns ringed. The UpSet plot (Lex et al., 2014) answers a different question: which of the top patterns occur together in the same sequences?
import matplotlib.pyplot as plt
import spmviz as sv
from spmviz.viz import plot_lattice, plot_upset
db = sv.datasets.make_daily_routines(300, random_state=0)
ps = sv.mine(db, 0.35, max_gap=2, max_length=4)
plot_lattice(ps, max_length=4, top_per_level=9)
plot_upset(ps.filter(min_length=2), top=7)
plt.show()
Total running time of the script: (0 minutes 0.275 seconds)

