pm4py.discovery.discover_temporal_profile#
- pm4py.discovery.discover_temporal_profile(log: EventLog | DataFrame, activity_key: str = 'concept:name', timestamp_key: str = 'time:timestamp', case_id_key: str = 'case:concept:name') Dict[Tuple[str, str], Tuple[float, float]] [source]#
Discovers a Temporal Profile from a log.
Implements the approach described in: Stertz, Florian, Jürgen Mangler, and Stefanie Rinderle-Ma. “Temporal Conformance Checking at Runtime based on Time-infused Process Models.” arXiv preprint arXiv:2008.07262 (2020).
The output is a dictionary containing, for every pair of activities that eventually follow each other in at least one case of the log, the average and the standard deviation of the time difference between their timestamps.
Example: If the log has two cases: - Case 1: A (timestamp: 1980-01) → B (timestamp: 1980-03) → C (timestamp: 1980-06) - Case 2: A (timestamp: 1990-01) → B (timestamp: 1990-02) → D (timestamp: 1990-03)
The returned dictionary will contain: ``` {
(‘A’, ‘B’): (1.5 months, 0.5 months), (‘A’, ‘C’): (5 months, 0), (‘A’, ‘D’): (2 months, 0)
}#
- type case_id_key:
str
- type timestamp_key:
str
- type activity_key:
str
- param log:
Event log or Pandas DataFrame.
- param activity_key:
Attribute to be used for the activity (default: “concept:name”).
- param timestamp_key:
Attribute to be used for the timestamp (default: “time:timestamp”).
- param case_id_key:
Attribute to be used as case identifier (default: “case:concept:name”).
- return:
A dictionary mapping each pair of activities to a tuple of (average time difference, standard deviation).
- rtype:
Dict[Tuple[str, str], Tuple[float, float]]
import pm4py temporal_profile = pm4py.discover_temporal_profile( dataframe, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp' )