pm4py.conformance.conformance_diagnostics_alignments#
- pm4py.conformance.conformance_diagnostics_alignments(log: EventLog | DataFrame, *args, multi_processing: bool = False, activity_key: str = 'concept:name', timestamp_key: str = 'time:timestamp', case_id_key: str = 'case:concept:name', variant_str: str | None = None, return_diagnostics_dataframe: bool = False, **kwargs) List[Dict[str, Any]] [source]#
Apply the alignments algorithm between a log and a process model. This method returns the full alignment diagnostics.
Alignment-based replay aims to find one of the best alignments between the trace and the model. For each trace, the output of an alignment is a list of pairs where the first element is an event (from the trace) or
»
and the second element is a transition (from the model) or»
. Each pair can be classified as follows:Sync move: The event and transition labels correspond, advancing both the trace and the model simultaneously.
Move on log: The transition is
»
, indicating a replay move in the trace that is not mirrored in the model. This move is unfit and signals a deviation.- Move on model: The event is
»
, indicating a replay move in the model not mirrored in the trace. These can be further classified as: Moves on model involving hidden transitions: Even if it’s not a sync move, the move is fit.
Moves on model not involving hidden transitions: The move is unfit and signals a deviation.
- Move on model: The event is
For each trace, a dictionary is associated containing, among other details:
alignment: The alignment pairs (sync moves, moves on log, moves on model).
cost: The cost of the alignment based on the provided cost function.
fitness: Equals 1 if the trace fits perfectly.
- Parameters:
log – Event log.
args – Specifications of the process model.
multi_processing (
bool
) – Boolean to enable multiprocessing (default is constants.ENABLE_MULTIPROCESSING_DEFAULT).activity_key (
str
) – Attribute to be used for the activity (default is “concept:name”).timestamp_key (
str
) – Attribute to be used for the timestamp (default is “time:timestamp”).case_id_key (
str
) – Attribute to be used as the case identifier (default is “case:concept:name”).variant_str – Variant specification (for Petri net alignments).
return_diagnostics_dataframe (
bool
) – If possible, returns a dataframe with the diagnostics instead of the usual output (default is constants.DEFAULT_RETURN_DIAGNOSTICS_DATAFRAME).
- Returns:
A list of dictionaries containing diagnostics for each trace.
- Return type:
List[Dict[str, Any]]
- Example:
-
- net, im, fm = pm4py.discover_petri_net_inductive(
dataframe, activity_key=’concept:name’, case_id_key=’case:concept:name’, timestamp_key=’time:timestamp’
) alignments_diagnostics = pm4py.conformance_diagnostics_alignments(
dataframe, net, im, fm, activity_key=’concept:name’, case_id_key=’case:concept:name’, timestamp_key=’time:timestamp’