Interoperability#
Three kinds of objects carry an analysis: a SequenceDatabase, a
PatternSet and NetworkX graphs. Every reader produces one of them
and every view consumes them, so spmviz combines with the rest of the Python
ecosystem and with Gephi, Cytoscape, R and spreadsheets.
Data in#
import spmviz as sv
db = sv.SequenceDatabase.from_event_log(df, case="case", activity="activity", timestamp="time")
db = sv.SequenceDatabase.from_spmf("sequences.txt") # SPMF input format
db = sv.io.read_xes("log.xes") # IEEE XES (process mining)
db = sv.SequenceDatabase.from_pm4py(log) # pm4py event log or data frame
db = sv.SequenceDatabase.from_strings(["a b c", "a c"]) # one sequence per string
db.to_event_log() # back to a long table
Patterns can be written as "a (b c) d", in the arrow notation
"wake up -> coffee -> (tv, read)" (items may contain spaces) or in the SPMF
format "1 -1 2 3 -1"; db.pattern(...) resolves item labels.
Other miners#
sv.mine(db, ..., algorithm=name) runs the built-in miners ("prefixspan",
"cmspam", "spam", "spade", "gsp") and external ones
("prefixspan-py", "seq2pat", "gsppy", "spmf"); every result is a
PatternSet with supporting sequences, so every view works on it.
sv.backends.available() lists the installed back ends.
Results out#
Call |
Result |
|---|---|
|
pandas data frame with all measures |
|
SPMF output with |
|
tables and JSON; |
|
them back |
|
extension network, lattice or similarity graph |
|
NetworkX graph with positions and attributes |
|
Gephi with positions, colors and sizes |
|
GraphML, GML, Cytoscape JSON, node-link JSON, |
|
Graphviz, Pajek |
|
igraph |
|
plotly figures; |