In this repository we provide a faithful implementation for computing precision 1-alignment based of Petri nets with respect to an event log, following the approach proposed in the paper "Measuring precision of modeled behavior".
A brief description of the algorithm is provided below:
-
For each trace
$\sigma_L$ in the log$L$ , compute one optimal alignment$\gamma = \Lambda^{1}(\sigma_L)$ , and let$\Lambda^{1}$ denote the multiset of these alignments over all traces in$L$ . -
Project each alignment
$\gamma$ to model behavior only (model moves and synchronous moves), obtaining a fully compliant sequence$\bar{\lambda}(\gamma)$ . Let$\bar{\lambda}(\Lambda^{1})$ be the multiset of projected sequences. -
Build the alignment automaton
$A_A=(Q,\Sigma,\delta,\epsilon,\omega)$ , where$Q$ contains all prefixes of the sequences in$\bar{\lambda}(\Lambda^{1})$ ,$\epsilon$ is the empty prefix, and$\delta$ is the prefix transition function. -
Assign a weight for each state
$s \in Q$ of the automaton$A_A$ as$\omega(s) = \sum_{\forall \gamma \in \bar \Lambda} \omega(\gamma)$ , where$\omega(\gamma)$ is the frequence of a sequence in$\bar \Lambda$ ; -
For each state, compute the set of its available actions, i.e. possible direct successor activities according to the model (
$a_v$ ) and then compare it with the set of executed actions, i.e. activities really executed in the traces ($e_x$ ); -
Compute precision for automaton
$A$ as follows:$a_p = \frac{\sum_{s}\omega (s) \cdot |e_x(s)|}{\sum_{s}\omega (s) \cdot |a_v(s)|}$ .
Consider the following process model, log and projected alignments.
| Process model | Projected alignments |
|---|---|
![]() |
![]() |
The corresponding automaton is:
therefore,
- Install PM4Py with pip
pip install -U pm4py-
Copy the script "precision_alignment.py" ref inside the folder
pm4py/algo/evaluation/precision/variants/. -
Add the variant inside the
pm4py/algo/evaluation/precision/algorithm.pyfile.
| Contributor name | Contacts |
|---|---|
Chiara Gobbi |
c.gobbi@pm.univpm.it |


