backend.conformance_checking.temporal_profile¶
Contains functionality for temporal conformance checking.
This module defines the TemporalProfile class which uses PM4Py to discover temporal profiles from event logs and checks conformance based on the discovered temporal profiles.
Attributes¶
Classes¶
Represents the temporal profile of an event log. |
Module Contents¶
- type backend.conformance_checking.temporal_profile.TemporalProfileType = Dict[Tuple[str, str], Tuple[float, float]]¶
- type backend.conformance_checking.temporal_profile.ConformanceResultType = List[List[Tuple[Any, ...]]]¶
- class backend.conformance_checking.temporal_profile.TemporalProfile(log: pandas.DataFrame, case_id_col: str | None = None, activity_col: str | None = None, timestamp_col: str | None = None)¶
Represents the temporal profile of an event log.
- log¶
The event log.
- _temporal_profile¶
The discovered temporal profile.
- _temporal_conformance_result¶
The result of temporal conformance checking.
- _zeta¶
The zeta value used for temporal conformance checking.
- case_id_col¶
The name of the Case ID column. Only needed if
- Type:
optional
- the log is read as a csv file.
- activity_col¶
The name of the Activity column. Only needed if the log is read as a csv file.
- Type:
optional
- timestamp_col¶
The name of the Timestamp column. Only needed if the log is read as a csv file.
- Type:
optional
- log: pandas.DataFrame¶
- case_id_col: str | None = None¶
- activity_col: str | None = None¶
- timestamp_col: str | None = None¶
- discover_temporal_profile() None ¶
Discovers the temporal profile from the log.
The result is stored in _temporal_profile which is a dictionary where each key is a tuple of two activity names (source, target), and the value is a tuple containing:
The mean duration between the two activities
The standard deviation of those durations.
- check_temporal_conformance(zeta: float = 0.5) None ¶
Checks conformance of the log against the temporal profile.
The result is stored in _temporal_conformance_result which is a list containing, for each trace, all the deviations. Each deviation is a tuple containing:
The source activity of the recorded deviation.
The target activity of the recorded deviation.
- The time passed between the occurrence of the source activity and the
target activity.
The value of (time passed - mean)/std for this occurrence (zeta).
- Parameters:
zeta – Multiplier for the standard deviation.
- Raises:
ValueError – If the temporal profile has not been discovered yet.
- get_temporal_profile() TemporalProfileType ¶
Returns the discovered temporal profile.
- Returns:
A dictionary where each key is a tuple of two activity names (source, target), and the value is a tuple containing:
The mean duration between the two activities
The standard deviation of those durations.
- Raises:
ValueError – If the temporal profile has not been discovered yet.
- get_temporal_conformance_result() ConformanceResultType ¶
Returns the result of temporal conformance checking.
- Returns:
The source activity of the recorded deviation.
The target activity of the recorded deviation.
The time passed between the occurrence of the source activity and the target activity.
The value of (time passed - mean)/std for this occurrence (zeta).
- Return type:
A list containing, for each trace, all the deviations. Each deviation is a tuple containing
- Raises:
ValueError – If the temporal conformance result has not been computed yet.
- get_zeta() float | None ¶
Returns the zeta value used for temporal conformance checking.
- Returns:
The zeta value used for temporal conformance checking.
- get_conformance_diagnostics() pandas.DataFrame ¶
Returns the result of temporal conformance checking as a DataFrame.
- Returns:
The Case ID of the recorded deviation.
The source activity of the recorded deviation.
The target activity of the recorded deviation.
The time passed between the occurrence of the source activity and the target activity.
The value of (time passed - mean)/std for this occurrence (zeta).
- Return type:
A DataFrame containing the deviations for each trace. Each row contains
- Raises:
ValueError – If the temporal conformance result has not been computed yet.
- get_sorted_coloured_diagnostics() pandas.io.formats.style.Styler ¶
Returns the diagnostics DataFrame with sorting and styling.
Sorts the diagnostics DataFrame in descending order of the number of standard deviations (num_st_devs) and applies a colour-coded strip to the rows based on the value of num_st_devs - zeta:
Green: If the value is less than 0.5
Yellow: If the value is between 0.5 and 1.0
Red: If the value is greater than 1.0
- Returns:
A styled DataFrame containing the sorted diagnostics with colour-coding.