Pattern landscapes#

A new view: the transaction map turned into a terrain. The support-weighted kernel density of the pattern coordinates is drawn as contour levels, and every peak is named after its most supported long pattern. Families of frequent patterns become mountains; isolated combinations stay in the plains.

import matplotlib.pyplot as plt

import spmviz as sv
from spmviz.viz import plot_landscape

db = sv.datasets.make_alarm_cascades(600, random_state=0)
ps = sv.mine(db, 0.05, max_length=5)
plot_landscape(ps, similarity="transaction", peaks=5)
pattern landscape (density of the map weighted by support)
<Axes: title={'left': 'pattern landscape (density of the map weighted by support)'}>

Parameter study: bandwidth#

fig, axes = plt.subplots(1, 3, figsize=(15, 4.8))
for ax, bw in zip(axes, (0.15, 0.3, 0.6)):
    plot_landscape(ps, ax=ax, bandwidth=bw, peaks=4, title=f"bandwidth {bw}")
plt.show()
bandwidth 0.15, bandwidth 0.3, bandwidth 0.6

Total running time of the script: (0 minutes 1.036 seconds)

Gallery generated by Sphinx-Gallery