pm4py.stats.get_frequent_trace_segments#
- pm4py.stats.get_frequent_trace_segments(log: EventLog | DataFrame, min_occ: int, activity_key: str = 'concept:name', timestamp_key: str = 'time:timestamp', case_id_key: str = 'case:concept:name') Counter [source]#
Retrieves frequent trace segments (sub-sequences of activities) from an event log. Each trace segment is preceded and followed by “…”, indicating that it can be part of a larger sequence.
- Parameters:
log – Event log (EventLog or pandas DataFrame).
min_occ (
int
) – Minimum number of occurrences for a trace segment to be included.activity_key (
str
) – Attribute to be used for the activity.timestamp_key (
str
) – Attribute to be used for the timestamp.case_id_key (
str
) – Attribute to be used as the case identifier.
- Returns:
A Counter object mapping trace segments to their occurrence counts.
import pm4py log = pm4py.read_xes("tests/input_data/receipt.xes") traces = pm4py.get_frequent_trace_segments(log, min_occ=100) print(traces)