spmviz.nbvfs.NBVFS#
- class spmviz.nbvfs.NBVFS(method='wn', layout='circle', weight='confidence', mds='smacof', similarity_weights=None, start_items=None, min_confidence=0.0, random_state=0)[source]#
Bases:
objectNetwork-based visualisation of frequent sequences (WN, CM, TM and fused maps).
- Parameters:
- method{“wn”, “cm”, “tm”, “fused”}
- layout{“circle”, “hierarchical”, “spring”}
Layout of the weighted network (
method="wn").- weight{“confidence”, “cumulative”}
Edge weight: extension confidence (paper) or cumulative confidence of the child (reference implementation).
- mds{“smacof”, “classical”, “sklearn”, “umap”, “tsne”}
Projection of the CM, TM and fused maps.
- similarity_weights
tupleof3floats,optional Weights of the confidence, transaction and content similarities of the fused map (
None: similarity network fusion).- start_items
itemorlist,optional Restrict the pattern set to sequences starting with these events before fitting.
- min_confidence
float WN: drop extensions (and their subtrees) with lower confidence.
- random_state
int
- Attributes:
- patterns_
PatternSet - graph_
networkx.DiGraph Extension network with node coordinates
x,y.- coordinates_
numpy.ndarrayofshape(n_patterns, 2) Map coordinates in the order of
patterns_(NaN for nodes removed bymin_confidence).- similarity_
numpy.ndarrayorNone The similarity that was projected (CM, TM, fused).
- stress_
floatorNone Normalized stress of the MDS projection.
- patterns_
Examples
>>> import spmviz as sv >>> db = sv.SequenceDatabase(["abcd", "abce", "abd", "acd", "bcd"]) >>> ps = sv.mine(db, 0.4) >>> wn = NBVFS("wn").fit(ps) >>> wn.graph_.number_of_edges() == len(ps) - len(ps.roots()) True >>> tm = NBVFS("tm").fit(ps) >>> tm.coordinates_.shape (14, 2)
- plot(ax=None, **kw)[source]#
Draw the map (see
spmviz.viz.plot_nbvfs()for the options).
- property positions_#
Node label → (x, y).