"""
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()
