pm4py.discovery.derive_minimum_self_distance#

pm4py.discovery.derive_minimum_self_distance(log: DataFrame | EventLog | EventStream, activity_key: str = 'concept:name', timestamp_key: str = 'time:timestamp', case_id_key: str = 'case:concept:name') Dict[str, int][source]#

Computes the minimum self-distance for each activity observed in an event log.

The self-distance of activity a in <a> is infinity, in <a, a> is 0, in <a, b, a> is 1, etc. The activity key ‘concept:name’ is used.

Parameters:
  • log – Event log or Pandas DataFrame.

  • activity_key (str) – Attribute to be used for the activity (default: “concept:name”).

  • timestamp_key (str) – Attribute to be used for the timestamp (default: “time:timestamp”).

  • case_id_key (str) – Attribute to be used as case identifier (default: “case:concept:name”).

Returns:

A dictionary mapping each activity to its minimum self-distance.

Return type:

Dict[str, int]

import pm4py

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