pm4py.conformance.conformance_temporal_profile#
- pm4py.conformance.conformance_temporal_profile(log: EventLog | DataFrame, temporal_profile: Dict[Tuple[str, str], Tuple[float, float]], zeta: float = 1.0, activity_key: str = 'concept:name', timestamp_key: str = 'time:timestamp', case_id_key: str = 'case:concept:name', return_diagnostics_dataframe: bool = False) List[List[Tuple[float, float, float, float]]] [source]#
Perform conformance checking on the provided log using the provided temporal profile. The result is a list of time-based deviations for every case.
For example, consider a log with a single case: - A (timestamp: 2000-01) - B (timestamp: 2002-01)
Given the temporal profile: ```python {
(‘A’, ‘B’): (1.5, 0.5), # (mean, std) (‘A’, ‘C’): (5.0, 0.0), (‘A’, ‘D’): (2.0, 0.0)
}#
and setting zeta to 1, the difference between the timestamps of A and B (2 years) exceeds the allowed time (1.5 months + 0.5 months), resulting in a deviation.
- type return_diagnostics_dataframe:
bool
- type case_id_key:
str
- type timestamp_key:
str
- type activity_key:
str
- type zeta:
float
- param log:
Log object.
- param temporal_profile:
- Temporal profile. For 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 temporal profile might look like:
-
(‘A’, ‘B’): (1.5, 0.5), # (mean, std) (‘A’, ‘C’): (5.0, 0.0), (‘A’, ‘D’): (2.0, 0.0)
- param zeta:
Number of standard deviations allowed from the average (default is 1.0). For example, zeta=1 allows deviations within one standard deviation from the mean.
- param activity_key:
Attribute to be used for the activity (default is “concept:name”).
- param timestamp_key:
Attribute to be used for the timestamp (default is “time:timestamp”).
- param case_id_key:
Attribute to be used as the case identifier (default is “case:concept:name”).
- param return_diagnostics_dataframe:
If possible, returns a dataframe with the diagnostics instead of the usual output (default is constants.DEFAULT_RETURN_DIAGNOSTICS_DATAFRAME).
- return:
A list containing lists of tuples representing time-based deviations for each case.
- rtype:
List[List[Tuple[float, float, float, float]]]
- Example:
-
- temporal_profile = pm4py.discover_temporal_profile(
dataframe, activity_key=’concept:name’, case_id_key=’case:concept:name’, timestamp_key=’time:timestamp’
) conformance_temporal_profile = pm4py.conformance_temporal_profile(
dataframe, temporal_profile, zeta=1, activity_key=’concept:name’, case_id_key=’case:concept:name’, timestamp_key=’time:timestamp’