pm4py.conformance.precision_alignments#

pm4py.conformance.precision_alignments(log: EventLog | DataFrame, petri_net: PetriNet, initial_marking: Marking, final_marking: Marking, multi_processing: bool = False, activity_key: str = 'concept:name', timestamp_key: str = 'time:timestamp', case_id_key: str = 'case:concept:name') float[source]#

Calculate the precision of the model with respect to the event log using alignments.

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.

The reference paper for the alignments-based precision (Align-ETConformance) is: Adriansyah, Arya, et al. “Measuring precision of modeled behavior.” Information systems and e-Business Management 13.1 (2015): 37-67.

In this approach, the different prefixes of the log are replayed (if possible) on the model. At the reached marking, the set of transitions that are enabled in the process model is compared with the set of activities that follow the prefix. The more the sets differ, the lower the precision value. The more the sets are similar, the higher the precision value.

Parameters:
  • log – Event log.

  • petri_net (PetriNet) – Petri net.

  • initial_marking (Marking) – Initial marking.

  • final_marking (Marking) – Final marking.

  • 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”).

Returns:

The precision value.

Return type:

float

Example:

```python import pm4py

net, im, fm = pm4py.discover_petri_net_inductive(

dataframe, activity_key=’concept:name’, case_id_key=’case:concept:name’, timestamp_key=’time:timestamp’

) precision_alignments = pm4py.precision_alignments(

dataframe, net, im, fm, activity_key=’concept:name’, case_id_key=’case:concept:name’, timestamp_key=’time:timestamp’