spmviz.networks.higher_order_network#

spmviz.networks.higher_order_network(db, max_order=3, min_support=5, threshold=None, include_end=False)[source]#

Variable-order network of the sequences (BuildHON; Xu, Wickramarathne & Chawla, 2016).

A first-order transition graph forgets where a walker came from. Here a node may carry history: "c|a.b" is item c reached after a then b. A longer context is kept only when its continuation distribution differs from that of the shorter context more than the threshold \(k/\log_2(1+\sigma)\) (order \(k\), support \(\sigma\) of the context; Kullback–Leibler divergence in bits), or a fixed threshold. Memory nodes thus mark the frequent sequences whose continuation cannot be told from the last event alone.

Returns:
networkx.DiGraph

Node attributes item, history, order, count, entropy; edge attributes count, probability.

Examples using spmviz.networks.higher_order_network#

Pattern-induced higher-order networks: when history matters

Pattern-induced higher-order networks: when history matters