skelevision package¶
skelevision.exceptions module¶
-
exception
skelevision.exceptions.
IllegalLogAction
¶ Bases:
Exception
Raised when an incorrect action is performed on a log (e.g. in a trace-to-frequency log import duplicated traces)
skelevision.miners module¶
-
class
skelevision.miners.
LogSkeleton
¶ Bases:
skelevision.miners.Miner
-
static
mine
(log, reqA, forbA)¶ Returns a dict, containing the mapping of the strings “relationships” and “statistics” to corresponding dict of relationships and statistics
- log: TraceLog
tracelog object
- reqA: set()
If one or more of the selected activities does not occur in a trace, the entire trace will be filtered out.
- forbA: set()
If one or more of the selected activities occurs in a trace, the entire trace will be filtered out.
- dict
mapping of the strings “relationships” and “statistics” to corresponding dict of relationships and statistics
-
static
skelevision.objects module¶
-
class
skelevision.objects.
TraceLog
(*args, **kwargs)¶ Bases:
collections.abc.MutableMapping
Representation of a trace log. Works like a base python dict, where the keys are tuples denoting individual traces (e.g. ‘(“a”, “b”, “c”)’ denoted trace ‘abc’) and the values denote the frequencies of the traces.
-
static
activity_2_freq
(trace)¶ For a given trace, return a mapping from activity to frequency in trace.
- trace: tuple of str
a trace as a tuple of activities
- dict
mapping from activity to frequency in trace
-
always_after
()¶ Returns a set of tuples, representing the pairs of the activities which after any occurrence of the first activity the second activity always occurs.
- set``of `tuples
pairs of the activities which after any occurrence of the first activity the second activity always occurs.
-
always_before
()¶ Returns a set of tuples, representing the pairs of the activities which before any occurrence of the first activity the second activity always occurs.
- set``of `tuples
pairs of the activities which before any occurrence of the first activity the second activity always occurs.
-
augment
(start='[>', end='[]')¶ Returns a similar TraceLog object where each trace contains an aditional start and end activity.
-
equivalence
()¶ Returns a set of tuples, representing the pairs of the activities which are always together in all of the traces the same number of times.
- set``of `tuples
the pairs of the activities which are always together in all of the traces the same number of times
-
filter_traces
(reqA=None, forbA=None)¶ Filters the tracelog based on required and forbidden activities.
- reqA: set()
If one or more of the selected activities does not occur in a trace, the entire trace will be filtered out.
- forbA: set()
If one or more of the selected activities occurs in a trace, the entire trace will be filtered out.
- TraceLog
Mapping from activity to coresponding event list.
-
follows
(distance=1)¶ Returns a mapping (aka. dict) from pairs of activities to frequency. A pair (a, b) is part of the mapping if activity b follows activity a, at a certain distance, in any of the traces.
- distance: int
Distance two activities have to be appart to be counted in the mapping.
-
static
freq_2_activities
(trace)¶ For a given trace, return a mapping from frequency to set of activities, with that frequency in the trace.
- trace: tuple of str
a trace as a tuple of activities
- dict
mapping from frequency to set activities in trace
-
static
from_txt
(filepath, delimiter=None, frequency_idx=0, first_activity_idx=2)¶ Parses a .txt file containing a trace log and returns a TraceLog object of it.
- filepath: path-like
The path to the .txt file.
- delimiter: str
Character delimiting the different values. Default None, thus splitting by all the whitespace.
- frequency_idx: int
Default 0.
- first_activity_idx: int
Default 2.
- TraceLog
Mapping from activity to coresponding event list.
-
static
from_xes
(filepath)¶ Parses a .xes or a .gz file containing a trace log and returns a TraceLog object of it.
- filepath: path-like
The path to the .xes or .gz file.
- TraceLog
Mapping from activity to coresponding event list.
-
property
labels
¶ Returns all the unique labels of activities in the trace log.
-
max_counter
()¶ Returns a dict, representing a Mapping from activity to the max amount of times the activity appears in any trace of the TraceLog.
None
- ‘dict’
Mapping from activity to the max amount of times the activity appears in any trace of the TraceLog.
-
min_counter
()¶ Returns a dict, representing a Mapping from activity to the min amount of times the activity appears in any trace of the TraceLog.
Parameters
None
- ‘dict’
Mapping from activity to the min amount of times the activity appears in any trace of the TraceLog.
-
never_together
()¶ Returns a set of tuples, representing the pairs of the activities which are never together in any of the traces.
- set of tuples
the pairs of the activities which are never together in any of the traces
-
save_to_file
(filepath, format='txt')¶ Save a TraceLog object as a .txt file.
-
statistics
()¶ Returns a dict, representing a Mapping from activity to it’s statistics, min, max and total occurance of the activity in the TraceLog.
Parameters
- activity: ‘str’
the name of the activity
- ‘dict’
Mapping from activity to the amount of times the activity appears in the TraceLog.
-
sum_counter
()¶ Returns a dict, representing a Mapping from activity to the amount of times the activity appears in the TraceLog.
None
- ‘dict’
Mapping from activity to the min, max and total amount of times the activity appears in the TraceLog.
-
static
skelevision.utils module¶
-
skelevision.utils.
follows
(trace, distance=1)¶ Returns a mapping (aka. dict) from pairs of activities to frequency. A pair (a, b) is part of the mapping if activity b directly follows activity a, in any of the traces.
- distance: int
Distance two activities have to be appart to be counted in the mapping.
-
skelevision.utils.
predecessors
(trace)¶ Returns a mapping (aka. dict) from pairs of activities to sets of activities which are followd by. A dict {a: (b, c)} is part of the mapping if activity b and c followed by activity a, in any of the traces.
- trace: TraceLog
tracelog object
- SortedSet
the pairs of the activities which are the successors in any of the traces
-
skelevision.utils.
successors
(trace)¶ Returns a mapping (aka. dict) from pairs of activities to sets of activities which follows. A dict {a: (b, c)} is part of the mapping if activity b and c follows activity a, in any of the traces.
- trace: TraceLog
tracelog object
- SortedSet
the pairs of the activities which are the successors in any of the traces