pm4py.stats.get_minimum_self_distance_witnesses#

pm4py.stats.get_minimum_self_distance_witnesses(log: EventLog | DataFrame, activity_key: str = 'concept:name', timestamp_key: str = 'time:timestamp', case_id_key: str = 'case:concept:name') Dict[str, Set[str]][source]#

Derives the minimum self-distance witnesses for each activity.

A ‘witness’ is an activity that occurs between two occurrences of the same activity at the minimum self-distance. For example, if the minimum self-distance of activity a is 2, then in a trace <a, b, c, a>, activities b and c are witnesses of a.

Parameters:
  • log – Event log (EventLog or pandas DataFrame).

  • 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 dictionary mapping each activity to a set of its witness activities.

import pm4py

msd_wit = pm4py.get_minimum_self_distance_witnesses(
    dataframe,
    activity_key='concept:name',
    case_id_key='case:concept:name',
    timestamp_key='time:timestamp'
)