<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Reviving Token-based Replay: Increasing Speed While Improving Diagnostics</article-title>
      </title-group>
      <contrib-group>
        <aff id="aff0">
          <label>0</label>
          <institution>Process and Data Science group</institution>
          ,
          <addr-line>Lehrstuhl fu ̈r Informatik 9 52074 Aachen</addr-line>
          ,
          <institution>RWTH Aachen University</institution>
          ,
          <country country="DE">Germany</country>
        </aff>
      </contrib-group>
      <pub-date>
        <year>1830</year>
      </pub-date>
      <fpage>0000</fpage>
      <lpage>0003</lpage>
      <abstract>
        <p>Token-based replay used to be the standard way to conduct conformance checking. With the uptake of more advanced techniques (e.g., alignment based), token-based replay got abandoned. However, despite decomposition approaches and heuristics to speed-up computation, the more advanced conformance checking techniques have limited scalability, especially when traces get longer and process models more complex. This paper presents an improved token-based replay approach that is much faster and scalable. Moreover, the approach provides more accurate diagnostics that avoid known problems (e.g., “token flooding”) and help to pinpoint compliance problems. The novel token-based replay technique has been implemented in the PM4Py process mining library. We will show that the replay technique outperforms state-of-the-art techniques in terms of speed and/or diagnostics.</p>
      </abstract>
      <kwd-group>
        <kwd>Log-Model Replay</kwd>
        <kwd>Process Diagnostics</kwd>
        <kwd>Localized Conformance Checking</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>
        The importance of conformance checking is growing as is illustrated by the new
book on conformance checking [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] and the Gartner report which states “we see
a significant trend toward more focus on conformance and enhancement process
mining types” [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ]. Conformance checking aims to compare an event log and a
process model in order to discover deviations and obtain diagnostics information
[
        <xref ref-type="bibr" rid="ref15">15</xref>
        ]. Deviations are related to process executions not following the process model
(for example, the execution of some activities may be missing, or the activities
are not happening in the correct order), and are usually associated with higher
throughput times and lower quality levels. Hence, it is important to detect them,
understand their causes and re-engineer the process in order to avoid such
deviations. A prerequisite for both conformance checking and performance analysis
is a replay technique, that relates and compares the behavior observed in the
log with the behavior observed in the model. Different replay techniques have
been proposed, like token-based replay [
        <xref ref-type="bibr" rid="ref17">17</xref>
        ] and alignments [
        <xref ref-type="bibr" rid="ref6 ref8">8, 6</xref>
        ]. In recent years,
alignments have become the standard-de-facto technique since they are able to
find an optimal match between the process model and a process execution
contained in the event log. Unfortunately, their performance on complex process
models and large event logs is poor.
      </p>
      <p>Token-based replay used to be the default technique, but has been almost
abandoned in recent years, because the handling of invisible transitions, that
are contained in the output models of algorithms like the heuristics miner or
the inductive miner, is based on heuristics and the technique suffer of several
know drawbacks. For example, models may get flooded with tokens in highly
non-conforming executions, enabling unwanted parts of the process model and
hampering the overall fitness evaluation. Moreover, detailed diagnostics have
been introduced only for alignments.</p>
      <p>In this paper, a revival of token-based replay is proposed by addressing some
of the weaknesses of traditional token-based replay techniques. The new
approach is supported by the PM4Py process mining library1.</p>
      <p>The remainder of the paper is organized as follows: in Section 2 an
introduction to token-based replay and alignments is provided. Section 3 presents the
novel approach which modifies the original technique and uses a different
implementation strategy. Section 4 proposes different ways to localize conformance
checking both prior (simplifying the model, reducing the complexity and the
time required to do token-based replay) and after the replay (evaluating which
elements of the Petri net are used and/or have encountered problems during the
replay operation). In Section 5, additional diagnostics are introduced based on
the localized replay output. Section 6 concludes the paper.
2</p>
    </sec>
    <sec id="sec-2">
      <title>Background and Related Work</title>
      <p>Petri nets are the most widely used process model in process mining
frameworks: popular discovery algorithms like the alpha miner and the inductive miner
(through conversion of the resulting process tree) can produce Petri nets. An
accepting Petri net is a Petri net along with a final marking.</p>
      <p>Definition 1 (Accepting Petri nets). A (labeled, marked) accepting Petri net
is a net of the form P N = (P, T, F, W, M0, MF , l), which extends the elementary
net so that:
– (P, T, F ) is a net (P and T are disjoint finite sets of places and transitions;</p>
      <p>F ⊆ (P × T ) ∪ (T × P ) is a set of arcs).
– W : F → N is an arc multiset, so that the count (or weight) for each arc is
a measure of the arc multiplicity.
– M0 : P → N is the initial marking2.
– MF : P → N is the final marking.
– l : T → P ∪{τ } is a labeling function that assigns to each transition t ∈ T
either a symbol from P (the set of labels) or the empty string τ .
The preset of a place, •p, is the set of all transitions t ∈ T such that (t, p) ∈ F .
The postset of a place, p•, is the set of all transitions t ∈ T such that (p, t) ∈ F .
The preset and postset of a transition could be defined in a similar way. A
1 The official website of the library is http://www.pm4py.org
2 A marking M : P → N is a place multiset.
transition t is said to be visible if l(t) ∈ P; is said to be hidden if l(t) = τ . If
for all t ∈ T such that l(t) 6= τ , |{t0 ∈ T |l(t0) = l(t)}| = 1, then the Petri net
contains unique visible transitions; otherwise, it contains duplicate transitions.
The initial marking is corresponding the initial state of a process execution.
Process discovery algorithms may associate also a final marking to the Petri
net, that is the state in which the process execution should end. The execution
semantics of a Petri net is the following:
– A transition t ∈ T is enabled (it may fire) in M if there are enough tokens in
its input places for the consumptions to be possible, i.e. iff ∀s ∈ •t : M (s) ≥
W (s, t).
– Firing a transition t ∈ T in marking M consumes W (s, t) tokens from each
of its input places s, and produces W (t, s) tokens in each of its output places
s.</p>
      <p>For a process supported by an information system, an event log is a set of
cases, each one corresponding to a different execution of the process. A case
contains the list of events that are executed (in the information system) in order
to complete the case. To each case and event, some attributes can be assigned
(e.g. the activity and the timestamp at the event level). A classification of the
event is a string describing the event (e.g. the activity is a classification of the
event). For each case, given a classification function, the corresponding trace is
the list of classifications associated with the events of the case.</p>
      <p>
        The application of token-based replay is done on a trace of an event log and
an accepting Petri net. The output of the replay operation is a list of
transitions enabled during the replay, along with some numbers: c is the number of
consumed tokens (during the replay), p is the number of produced tokens, m is
the number of missing tokens, r is the number of remaining tokens. At the start
of the replay, it is assumed that the tokens in the initial marking are inserted
by the environment, increasing p accordingly (for example, if the initial marking
consists of one token in one place, then the replay starts with p = 1). The replay
operation considers, in order, the activities of the trace. In each step, the set of
enabled transitions in the current marking is retrieved. If there is a transition
corresponding to the current activity, then it is fired, a number of tokens equal
to the sum of the weight of input arcs is added to c, and a number of tokens
equal to the sum of the weight of output arcs is added to p. If there is not a
transition corresponding to the current activity enabled in the current
marking, then a transition in the model corresponding to the activity is searched (if
there are duplicate corresponding transitions, then [
        <xref ref-type="bibr" rid="ref17">17</xref>
        ] provides an algorithm to
choose between them). Since the transition could not fire in the current marking,
the marking is modified by inserting the token(s) needed to enable it, and m is
increased accordingly. At the end of the replay, if the final marking is reached,
it is assumed that the environment consumes the tokens from the final marking,
and c is increased accordingly. If the marking reached after the replay of the
trace is different from the final marking, then missing tokens are inserted and
remaining tokens r are set accordingly.
      </p>
      <p>
        The following relations hold during the replay: c ≤ p + m and m ≤ c. The
relation p + m = c + r holds at the end of the replay. A fitness value could be
calculated for the trace as:
fσ =
1 m
2 1 − c
+
For each case Li of the event log L, let ci be the number of consumed tokens,
pi the number of produced tokens, mi the number of missing tokens and ri the
number of remaining tokens. Then, the following formula calculates the fitness
at the log level
fL =
This quantity is different from the average of fitness values at trace level. When,
during the replay, a transition corresponding to the activity could not be enabled,
and invisible transitions are present in the model, a technique is deployed to
traverse the state space (see [
        <xref ref-type="bibr" rid="ref17">17</xref>
        ]) and possibly reach a marking in which the
given transition is enabled. A heuristic (see [
        <xref ref-type="bibr" rid="ref17">17</xref>
        ]) that uses the shortest sequence
of invisible that enables a visible task is proposed. This heuristic tries to minimize
the possibility that the execution of an invisible transition interferes with the
future firing of another activity.
      </p>
      <p>
        A well-known problem for token-based replay is the token flooding problem [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ].
Indeed, when the case differs much from the model, and a lot of missing tokens
are inserted during the replay, it happens that also a lot of tokens remain unused
and many transitions are enabled. This leads to misleading diagnostics because
unwanted parts of the model may be activated, and so the fitness value for
highly problematic executions may be too high. To illustrate the token-flooding
problem consider a process model without concurrency (only loops, sequences,
and choices) represented as a Petri net. At any stage, there should be at most
one token in the Petri net. However, each time there is a deviation, a token may
be added resulting in a state which was never reachable from the initial state.
      </p>
      <p>
        The original token-based replay implementation [
        <xref ref-type="bibr" rid="ref17">17</xref>
        ] was only implemented
in earlier versions of the ProM framework (ProM4 and ProM5) and proposes
localized metrics on places of the Petri net that help to understand which parts
of the model are more problematic. To improve performance in the original
implementation, a preprocessing step could be used to group cases having the
same trace. In this way, the replay of a unique trace is done once by the
tokenbased replay. Alternatively, more ad-hoc token-based replay approaches were
used by the heuristic miner and the genetic miner. In the latter approach, the
qualities of candidate models are derived. These techniques tend to put multiple
dimensions (replay fitness, precision, etc.) into a single fitness measure.
      </p>
      <p>
        Currently, the standard replay technique on Petri nets is the computation
of alignments. There are different approaches on alignments [
        <xref ref-type="bibr" rid="ref6 ref8">8, 6</xref>
        ]. In the
assessment, we are considering the approach described in [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]. Execution speed of
alignments on process models containing a lot of different states may be
problematic, although some techniques have been proposed, such as decomposing
alignments [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] and recomposing them [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ]. Moreover, the approach described in
[
        <xref ref-type="bibr" rid="ref18">18</xref>
        ] is also helping to handle bigger instances, making the user decide about the
granularity of the alignment steps.
3
3.1
      </p>
    </sec>
    <sec id="sec-3">
      <title>Improved Token-Based Replay</title>
      <sec id="sec-3-1">
        <title>Changes to the Approach</title>
        <p>
          The approach proposed in [
          <xref ref-type="bibr" rid="ref17">17</xref>
          ] is relatively fast when there are no duplicate or
silent transitions. However, in comparison to the alignments, managing invisible
transitions may be time-consuming due to the necessary state-space explorations.
        </p>
        <p>The idea proposed in this paper is to perform a pre-processing step in order
to store a map of the shortest paths between places, and then use this map
when hidden transitions need to be traversed. This saves the time necessary to
perform the state-space explorations. Therefore, the proposed approach works
with accepting Petri nets that have no invisible transitions with empty preset or
postset, since they would not belong to any shortest path between places.
3.2</p>
      </sec>
      <sec id="sec-3-2">
        <title>Preprocessing Step: Shortest Paths Between Places</title>
        <p>Given an accepting Petri net P N = (P, T, F, W, M0, MF , l), it is possible to
define a directed graph G = (V, A) such that the vertices V are the places P of
the Petri net, and A ⊆ P × P is such that (p1, p2) ∈ A if and only if at least one
invisible transition connects p1 to p2. Then, to each arc (p1, p2) ∈ A, a transition
τ(p1, p2) could be associated picking one of the invisible transitions connecting
p1 to p2.</p>
        <p>Using an informed search algorithm for traversing the graph G, the shortest
paths between nodes are found. These are a sequence of edges ha1, . . . ani of
minimal length, that correspond to a sequence of transitions ht1, . . . , tni using
the mapping provided by τ.</p>
        <p>Given a marking M such that M (p1) &gt; 0 and M (p2) = 0, a marking M 0
where M 0(p2) &gt; 0 could be reached by firing the sequence ht1, . . . , tni that is the
shortest path in G between p1 and p2. The following subsection will explain how
to apply the shortest paths to traverse invisible transitions and reach a marking
where a transition is enabled.
3.3</p>
      </sec>
      <sec id="sec-3-3">
        <title>Enabling Transitions</title>
        <p>
          The approach described in this subsection helps to enable a transition t through
the traversal of invisible transitions. This helps in avoiding the insertion of
missing tokens when an activity needs to be replayed on the model, but no
corresponding transition is enabled in the current marking M . Moreover, it helps to
avoid time-consuming state-space explorations that are required by the approach
proposed in [
          <xref ref-type="bibr" rid="ref17">17</xref>
          ].
        </p>
        <p>For a marking M and a transition t, it is possible to define the following sets:
– Δ(M, t) = {p ∈ •t | M (p) &lt; W (p, t)} is the set of places that miss some
tokens to enable transition t. If the set Δ(M, t) is not empty, then the
transition t could not be enabled in the marking M .
– Λ(M, t) = {p ∈ P | W (p, t) = 0 ∧ M (p) &gt; 0} is the set of places for which
the marking has at least one token and t does not require any of these places
to be enabled.</p>
        <p>When t is not enabled, the set Δ(M, t) is not empty. The idea is about using
places in Λ(M, t) (that are not useful to enable t) and, through the shortest
paths, reach a marking M 0 where t is enabled.</p>
        <p>Given a place p1 ∈ Λ(M, t) and a place p2 ∈ Δ(M, t), if a path exists
between p1 and p2 in G, then it is useful to see if the corresponding
shortest path ht1, . . . , tni could fire in marking M . If that is the case, a marking
M 0 could be reached having at least one token in p2. However, the path may
not be not realizable, or may require a token from one of the input places of
t. So, the set Δ(M 0, t) may be smaller than Δ(M, t), since p2 gets at least
one token. The approach is about considering all the combinations of places
(p1, p2) ∈ Λ(M, t) × Δ(M, t) such that a path exists between p1 and p2 in G.
These combinations, namely {(p1, p2), (p01, p02), (p010, p020) . . .}, are corresponding to
some shortest paths S = {ht1, . . . , tmi, ht01, . . . , t0ni, ht010, . . . , t0o0i} in G.</p>
        <p>The algorithm to enable transition t through the traversal of invisible
transitions considers the sequences of transitions in S, ordered by length, and tries
to fire them. If the path can be executed, a marking M 0 is reached, and the set
Δ(M 0, t) may be smaller than Δ(M, t), since a place in Δ(M, t) gets at least
one token in M 0. However, one of the following situations could happen: 1) no
shortest path between combinations of places (p1, p2) ∈ Λ(M, t) × Δ(M, t) could
fire: in that case, we are “stuck” in the marking M , and the token-based replay
is forced to insert the missing tokens; 2) a marking M 0 is reached, but Δ(M 0, t)
is not empty, hence t is still not enabled in marking M 0. In that case, the
approach is iterated on the marking M 0; 3) a marking M 0 is reached, and Δ(M 0, t)
is empty, so t is enabled in marking M 0. When situation (2) happens, the
approach is iterated. A limit on the number of iterations may be set, and if it is
exceeded then the token-based replay proceeds to insert the missing tokens in
marking M .</p>
        <p>The approach is straightforward when sound workflow nets without
concurrency (only loops, sequences, and choices) are considered, since in the considered
setting (M marking where transition t is not enabled) both sets Λ(M, t) and
Δ(M, t) have a single element, a single combination (p1, p2) ∈ Λ(M, t) × Δ(M, t)
exists and, if a path exists between p1 and p2 in G, and the shortest path could
fire in marking M , a marking M 0 will be reached such that Δ(M 0, t) = ∅ and
transition t is enabled. Moreover, it performs particularly well on models that
are output of popular process discovery algorithms, e.g., inductive miner,
heuristics miner, etc., where potentially long chains of invisible (skip, loop) transitions
needs to be traversed in order to enable a transition. The approach described in
this subsection can also manage duplicate transitions corresponding to the
activity that needs to be replayed. In that case, we are looking to enable any one of the
transitions belonging to the set TC ⊆ T that contains all the transitions
corresponding to the activity in the trace. The approach is then applied on the shortest
paths between places (p1, p2) ∈ ∪t∈TC Λ(M, t) × Δ(M, t). A similar approach can
be applied to reach the final marking when, at the end of the replay of a trace,
a marking M is reached that is not corresponding to the final marking. In that
case, Δ = {p ∈ P | M (p) &lt; MF (p)} and Λ = {p ∈ P | MF (p) = 0 ∧ M (p) &gt; 0}.
This does not cover the case where the reached marking contains the final
marking but has too many tokens.
3.4</p>
      </sec>
      <sec id="sec-3-4">
        <title>Token Flooding Problem</title>
        <p>
          To address the token flooding problem, which is one of the most severe problems
when using token-based replay, we propose several strategies. The final goal
of these strategies is to avoid the activation of transitions that shall not be
enabled, keeping the fitness value low for problematic parts of the model. The
common pattern behind these strategies is to determine superfluous tokens, that
are tokens that cannot be used anymore. During the replay, f (initially set to
0) is an additional variable that stores the number of “frozen” tokens. When
a token is detected as superfluous, it is “frozen”: that means, it is removed
from the marking and f is increased. Frozen tokens, like remaining tokens, are
tokens that are produced in the replay but never consumed. Hence, at the end
of the replay p + m = c + r + f . To each token in the marking, an age (number of
iterations of the replay for which the token has been in the marking without being
consumed) is assigned. The tokens with the highest age are the best candidates
for removal. The techniques to detect superfluous tokens are deployed when a
transition required the insertion of missing tokens to fire, since the marking
would then possibly contain more tokens. One of the following strategies can be
used:
1. Using a decomposition of the Petri net in semi-positive invariants [
          <xref ref-type="bibr" rid="ref11">11</xref>
          ] or
S-components [
          <xref ref-type="bibr" rid="ref1">1</xref>
          ] to restrict the set of allowed markings. Considering
Scomponents, each S-component should hold at most 1 token, so it is safe to
remove the oldest tokens if they belong to a common S-component.
2. Using place bounds [
          <xref ref-type="bibr" rid="ref12">12</xref>
          ]: if a place is bounded to N tokens and during the
replay operation the marking contains M &gt; N tokens for the place, the
“oldest” tokens according to the age are removed.
3.5
        </p>
      </sec>
      <sec id="sec-3-5">
        <title>Changes to the Implementation to Improve Performance</title>
        <p>
          The implementation of the approach proposed in [
          <xref ref-type="bibr" rid="ref17">17</xref>
          ] has been made more
efficient thanks to ideas adopted from the alignments implementation in ProM6
[
          <xref ref-type="bibr" rid="ref5">5</xref>
          ]:
1. Post-fix caching: a post-fix is the final part of a case. During the replay of
a case, the couple marking+post-fix is saved in a dictionary along with the
list of transitions enabled from that point to reach the final marking of the
model. For the next replayed cases, if one of them reaches exactly a marking
+ post-fix setting saved in the dictionary, the final part of the replay could
be retrieved from the dictionary.
2. Activity caching: activity caching means saving in a dictionary, during the
replay of a case, the list of hidden transitions enabled from a given marking
to reach a marking where a particular transition is enabled. For the next
replayed cases, if one of them reaches a marking + target transition setting
saved in the dictionary, then the corresponding hidden transitions are fired
accordingly to enable the target transition.
3.6
        </p>
      </sec>
      <sec id="sec-3-6">
        <title>Evaluation</title>
        <p>
          In this section, the token-based replay (as implemented in the PM4Py library)
is assessed, looking at the speed and the output of the replay, against the
alignments approach (as implemented in the “Replay a Log on Petri Net for
Conformance Analysis” plug-in of ProM6). Alignments produce results that differ
from token-based replay, so results are not directly comparable. Both are replay
techniques, so the goal of both techniques is to provide information about how
much a process execution is fit according to the process model (albeit the
fitness measures are defined in a different way, and so are intrinsically different).
This is valid in particular for the comparison of execution times: a trace may
be judged fitting according to a process model in a significantly lower amount
of time using token-based replay in comparison to alignments. If an execution is
unfit according to the model, it can also be judged unfit in a significantly lower
amount of time. For a comparison between the two approaches, read Section 8.4
of book [
          <xref ref-type="bibr" rid="ref8">8</xref>
          ] or consult [
          <xref ref-type="bibr" rid="ref16 ref3">16, 3</xref>
          ].
        </p>
        <p>In Table 1, an evaluation of the performance of the token-based replayer on
real-life logs respectively is provided. Tests have been done on a Intel I7-5500U
powered computer with 16 GB DDR4 RAM. The logs can be retrieved from the
4TU log repository3. The T.I.P4Pys column shows the execution time (in
seconds) of the token-based replay implementation in PM4Py on a model extracted
by the inductive miner approach on the given log, the A.I.P6s column shows the
execution time of the alignment-based implementation in ProM6 on the same
log and model. The Speedup column shows how many times the token-based
replay is faster than the alignment-based implementation. For real-life logs and
models extracted by the inductive miner, the token-based replay implementation
in PM4Py is 5 times faster on average. Even for large logs, the replay time is
less than a few seconds.</p>
        <p>In Table 2, the effectiveness of the implementation is evaluated in order
to understand how the improvements in the implementation contribute to the
overall efficiency of the approach. Columns in the table represent the execution
time of the replay approach when no caching, only post-fix caching, only activity
caching and the sum of post-fix caching and activity caching is deployed. In the
vast majority of logs, the combination of post-fix caching and activity caching
provides the best efficiency.</p>
        <p>In Table 3, a comparison between the fitness values recorded by the
tokenbased replay implementation in PM4Py, the token-based replay implementation
in ProM5 and the alignments implementation in ProM6 is provided, for both
alpha miner and inductive miner models. The meaning of the columns is the
following: F.I.PM4Py is the fitness value achieved by the token-based replay
implementation in PM4Py on a model extracted by the inductive miner
approach on the given log, F.I.P5 is the fitness value achieved by the token-based
replay implementation in ProM5 on a model extracted by the inductive miner
approach on the given log, F.I.P6 is the fitness value achieved by the alignments
implementation in ProM6 on a model extracted by the inductive miner approach
on the given log, F.A.PM4Py is the fitness value achieved by the token-based
replay implementation in PM4Py on a model extracted by the alpha miner
approach on the given log, F.A.P5 is the fitness value achieved by the token-based
replay implementation in ProM5 on a model extracted by the alpha miner
approach on the given log. For some real-life logs (bpic2017, roadtraffic, Billing) the
token-based replay implementation in ProM5 did not succeed in the replay in
10 minutes (an empty space has been reported in the corresponding columns).
Alignments have not been evaluated on the models extracted by alpha miner
since it is not assured to have a sound workflow net to start with. The fitness
values obtained in Table 3 show that the token-based replay implementation
in PM4Py (without the token flood cleaning procedure), on these logs and the
models extracted from them by the inductive miner, is as effective in exploring
hidden transitions as the token-based replay implementation in ProM5 and the
alignments implementation in ProM6.</p>
        <p>In order to compare token-based replay and alignments, a comparison
between the output of the two approaches has been proposed in Table 4. Some
popular logs, that are taken into account also for previous evaluations, are being
filtered in order to discover a model (using inductive miner) that is not perfectly
fit against the original log. Instead of comparing the fitness values, the
comparison is done on the similarity between the set of transitions that were activated in
the model during the alignments and the set of transitions that were activated
in the model during the token-based replay. The more similar are the two sets,
the higher should be the value of similarity. The similarity is calculated as the
ratio of the size of the intersection of the two sets and the size of the union of
the two sets. This is a simple approach, with some limitations: 1) transitions are
counted once during the replay 2) the order in which transitions are activated
is not important 3) the number of transitions activated by the alignments is
intrinsically higher: while token-based replay could just insert missing tokens and
proceed, alignments have to find a path in the model from the initial marking
to the final marking, so a higher number of transitions is expected. In Table 4,
the meaning of the columns is the following: Tot.T.Al. is the number of
transitions activated by the alignments approach (a path leading from the initial to
the final marking); Tot.T.TR. is the number of transititions activated by the
token-based replay approach (that is not necessarily a path from the initial to
the final marking); Min.sim. is the minimum similarity score between the
alignments and the token-based replay approach on a case; Max.sim. is the maximum
similarity score; Avg.sim. is the average similarity score; Med.sim. is the median
similarity score; Fit.al. is the fitness value provided by alignments, Fit.tr. is the
fitness value provided by token-based replay. This comparison, aside fitness
values, confirm that the result of the two replay operations, represented as a set
of transitions activated in the model, is very similar, with the exception of the
”Road Traffic Fine Management Process” log. For this log, the auto-filtering
procedure of PM4Py produces an overly simple model, where token-based
replay could survive by inserting missing tokens, but alignments cannot, hence the
significantly larger number of transitions activated in the model to explain the
behavior observed in the log. Table 4 provides some evidence, aside from fitness
values, that the output of the two replay techniques is comparable.</p>
        <p>
          To illustrate the importance of handling the token flooding problem, we
consider the ”Receipt phase of an environmental permit application process” event
log. On this log, a sound workflow net has been extracted which is represented
in Figure 1. For this log and model, token flooding occurs because the order
of activities is interchanged in some variants of the log. As missing tokens are
inserted multiple activities become enabled due to the surplus of tokens. As a
result, token-based replay using the original approach yields diagnostics very
different from the alignment-based approaches. The original values of average
trace fitness and log fitness are 0.92 and 0.93 respectively. Applying the token
flooding cleaning procedure, the values go down to 0.86 and 0.87 respectively,
because the activation of unwanted parts of the process model is avoided. Albeit
the underlying concepts/fitness formula are different (see Section 8.4 of [
          <xref ref-type="bibr" rid="ref8">8</xref>
          ]), it
may be useful to see that the fitness value provided by alignments is 0.82, so with
the token flooding cleaning procedure a more similar value of fitness is obtained.
3.7
        </p>
      </sec>
      <sec id="sec-3-7">
        <title>Problems Not Addressed</title>
        <p>The pre-processing step that stores a map of shortest paths between places is
sensible to the presence in the model of implicit/redundant places. Indeed, two
models with the same behavior can give different values. However, implicit places
can be removed as a pre-processing step on the model. Token-based replay can
return a list of transitions that have been activated in the model to replay the
trace. However, this does not imply that a path through the model, from the
initial to the final marking, is provided, since the insertion of missing tokens can
happen if a transition needs to be enabled.
4</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>Approach: Localization of Conformance Checking</title>
    </sec>
    <sec id="sec-5">
      <title>Results</title>
      <p>Next to providing an overall measure for conformance, conformance checking
should also provide diagnostics pinpointing compliance problems. Therefore, we
propose two localization approaches:
– The simplification of the original Petri net, in order to make the replay
execution speed faster considering only the most problematic parts of a process
model.
– The localization of problems encountered during the replay, that permits to
understand where deviations happened and their effects.
Fig. 2: Petri net, obtained from the ”Running example” log, projected on a
specific place. This kind of simplification helps to reduce the execution time of
the replay operation, and to avoid the token flooding problem. The diagnostics
obtained by applying our improved token-based replay are represented.
4.1</p>
      <sec id="sec-5-1">
        <title>Simplification of the Original Petri Net</title>
        <p>Replay operations on large models may take too much time. However, it is
possible to simplify the model, keeping only parts that are problematic, in order to
reduce the execution time of the replay operation.</p>
        <p>
          The decomposition techniques presented in [
          <xref ref-type="bibr" rid="ref13 ref14 ref2 ref7">2, 13, 14, 7</xref>
          ] have been used to
decompose a Petri net in several subnets for performance reasons. However, for
diagnostic purposes an automated decomposition driven only by the model’s
structure is undesirable. Therefore, we provide the possibility to specify a list of
activities in the log and corresponding transitions in the model to check. This is
particularly useful when the user knows already which parts of the process are
or could be problematic. We also add the possibility to get detailed information
about a single element (place or transition) of the Petri net. This information is
valuable when comparing fitting executions versus non-fitting executions.
        </p>
        <p>
          With token-based replay, we propose two simplification approaches to focus
attention:
– Projection on a specific place: when the preset and the postset of the place
are not empty and contain only unique visible transitions, then it is possible
to obtain a Petri net containing only the place and the transitions belonging
to the preset and the postset. This is particularly useful to detect instances
where some tokens are missing / are remaining on the specific place, while
not being affected by problems like token flooding. A representation of a Petri
net projected on a specific place, obtained from the ”Running example” log,
is shown in Figure 2.
– Projection on a set of activities: it is possible to make selected transitions
invisible and retain only the transitions that have a label belonging to a
specified set of activities as visible. Then reduction rules are applied to simplify
the model with respect to the invisible transitions [
          <xref ref-type="bibr" rid="ref4">4</xref>
          ]. This guarantees to get
a Petri net that, for the specific set of activities, has the same language as
the original Petri net.
from pm4py . o b j e c t s . l o g . importer . xes import f a c t o r y as x e s i m p o r t e r
from pm4py . a l g o . d i s c o v e r y . i n d u c t i v e import f a c t o r y as i n d u c t i v e m i n e r
from pm4py . a l g o . conformance . t o k e n r e p l a y import f a c t o r y
as t o k e n b a s e d r e p l a y
from pm4py . e v a l u a t i o n . r e p l a y f i t n e s s import f a c t o r y
as r e p l a y f i t n e s s f a c t o r y
l o g = x e s i m p o r t e r . apply ( ”C: \ \ running−example . xes ” )
net , im , fm = i n d u c t i v e m i n e r . apply ( l o g )
a l i g n e d t r a c e s = t o k e n b a s e d r e p l a y . apply ( log , net , im , fm )
f i t n e s s = r e p l a y f i t n e s s f a c t o r y . apply ( log , net , im , fm )
Fig. 3: Example PM4Py code to apply token-based replay to a log and an
accepting Petri net.
4.2
        </p>
      </sec>
      <sec id="sec-5-2">
        <title>Localization of the Replay Results</title>
        <p>
          Localizing fitness issues in the process model is an essential step in the provision
of more detailed diagnostics. The approach described in [
          <xref ref-type="bibr" rid="ref17">17</xref>
          ] already provided
some diagnostics aimed at localizing the problem:
– Place underfedness: when missing tokens are inserted in the place during
the replay operation of a case, the place is signed as underfed (it has fewer
tokens than needed at some stage) for the specific case.
– Place overfedness: when remaining tokens are in the place after the end of
the replay of a case, the place is signed as overfed (it has more tokens than
needed) for the specific case.
        </p>
        <p>To introduce additional localized diagnostics at the transition level, it is
important to notice that, when the transition is fired during the replay of a case,
is possible to register the current case status, for example recording all values of
the attributes of the current and of the previous events of the case. The easiest
option is to keep a single value for each attribute, that is corresponding to the
value of the last occurrence of the given attribute. So, the following localized
information could be introduced at the transition level:
– Transition underfedness: some tokens needed to fire the transition are
missing. It is possible to flag a transition as underfed for the specific case, saving
also the status of the case when the transition has been fired.
– Transition fitness: the transition could be fired regularly. In this case, it is
possible to save the status of the case when the transition has been fired.
It is important also the save information for events with an activity that is not
corresponding to any transition in the model. This could be done saving the
current case status when such activities happen.</p>
        <p>The result of localization on a filtered version of the ”Receipt phase of an
environmental permit application process” event log, and the model represented
in Figure 1, is shown in Table 5 (for places with problems) and Table 6 (for
transitions with problems). Moreover, in Figure 2 the fitness information has
been projected visually on the elements of the Petri net.
5</p>
      </sec>
    </sec>
    <sec id="sec-6">
      <title>Advanced Diagnostics</title>
      <p>The localized information is useful to compare, for each problematic entity, the
set of cases of the log that are fit according to the given entity and the set of
cases of the log that are not fit according to the given entity (called “unfit”). In
particular, the following questions can be answered:
1. If a given transition is executed in an unfit way, what is the effect on the
throughput time?
2. If a given activity that is not contained in the process model is executed,
what is the effect on the throughput time?</p>
      <p>These questions can be answered by throughput time analysis. Essentially,
an aggregation (for example, the median) of the throughput times of fit and
unfit cases is taken into account, and the results compared. Usually, transitions
executed in an unfit way are corresponding to higher throughput times.</p>
      <p>The comparison between the throughput time in non-fitting cases and fitting
cases permits to understand, for each kind of deviation, whether it is important
or not important for the throughput time. For evaluating this, the ”Receipt phase
of an environmental permit application process” log is taken. After some filtering
operations, the model represented in Figure 1 is obtained. Several activities that
are in the log are missing according to the model, while some transitions have
fitness issues. After doing the token-based replay enabling the local
information retrieval, and applying the duration diagnostics.diagnose from trans fitness
function to the log and the transitions fitness object, it can be seen that transition
T06 Determine necessity of stop advice is executed in an unfit way in 521 cases.
For the cases where this transition is enabled according to the model the median
throughput time is around 20 minutes, while in the cases where this transition is
executed in an unfit way the median throughput time is 1.2 days. So, the
throughput time of unfit cases is 146 times higher in median than the throughput time of
fit cases. Considering activities of the log that are not in the model, that are likely
to make the throughput time of the process higher since they are executed rarely,
applying the duration diagnostics.diagnose from not existing activities method
it is possible to retrieve the median execution of cases containing these
activities, and compare it with the median execution time of cases that do not contain
them (that is 20 minutes). Taking into account activity T12 Check document X
request unlicensed, it is contained in 44 cases, which median throughput time is
6.9 days (505 times higher than standard).
6</p>
    </sec>
    <sec id="sec-7">
      <title>Conclusion</title>
      <p>In this paper, an improved token-based replay approach has been proposed and
has been implemented in the Python process mining library PM4Py4. A set of
process discovery, conformance checking and enhancement algorithms are
provided in the library. An example script, that loads a log, calculates a model,
and does conformance checking, is shown in Figure 3. This illustrates that the
conformance checking technique presented in this paper can be combined easily
with many other process mining and machine learning approaches.</p>
      <p>The approach has shown to be more scalable than existing approaches. Due
to a better handling of invisible transitions and improved intermediate storage
techniques, the approach outperforms the original token-based approaches, and
proves to be faster than alignment-based approaches also for models with
invisible transitions.</p>
      <p>Next to an increase is speed, the problem of token flooding is addressed by
“freezing” superfluous tokens (see Section 3.4). This way replay does not lead
to markings with many more tokens than what would be possible according to
the model, avoiding the activation of unwanted parts of the process models and
leading to lower values of fitness for problematic parts of the model.</p>
      <p>Localization of conformance checking using token-based replay can be used
to simplify the model prior to replay and help to better diagnose where the
deviation happened. Moreover, we showed that we are able to diagnose the effects
of deviations on the case throughput time.</p>
      <p>The approach has been fully implemented in the PM4Py process mining
library. We hope that this will trigger a revival of token-based replay, a technique
that seemed abandoned in recent years. Especially when dealing with large logs,
complex models, and real-time applications, the flexible tradeoff between quality
and speed provided by our implementation is beneficial.
4 It can be installed in Python ≥ 3.6 through the command pip install pm4py. See
http://pm4py.pads.rwth-aachen.de/installation/ for details.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>van der Aalst</surname>
          </string-name>
          , W.:
          <article-title>Structural characterizations of sound workflow nets</article-title>
          .
          <source>Computing Science Reports</source>
          <volume>96</volume>
          (
          <issue>23</issue>
          ),
          <fpage>18</fpage>
          -
          <lpage>22</lpage>
          (
          <year>1996</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>van der Aalst</surname>
          </string-name>
          , W.:
          <article-title>Decomposing Petri nets for process mining: A generic approach</article-title>
          .
          <source>Distributed and Parallel Databases</source>
          <volume>31</volume>
          (
          <issue>4</issue>
          ),
          <fpage>471</fpage>
          -
          <lpage>507</lpage>
          (
          <year>2013</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>van der Aalst</surname>
          </string-name>
          , W.,
          <string-name>
            <surname>Adriansyah</surname>
          </string-name>
          , A.,
          <string-name>
            <surname>van Dongen</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          :
          <article-title>Replaying history on process models for conformance checking and performance analysis</article-title>
          .
          <source>Wiley Interdisciplinary Reviews: Data Mining and Knowledge Discovery</source>
          <volume>2</volume>
          (
          <issue>2</issue>
          ),
          <fpage>182</fpage>
          -
          <lpage>192</lpage>
          (
          <year>2012</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>van der Aalst</surname>
            , W., van Hee,
            <given-names>K.M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>ter Hofstede</surname>
            ,
            <given-names>A.H.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Sidorova</surname>
            ,
            <given-names>N.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Verbeek</surname>
            ,
            <given-names>H.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Voorhoeve</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Wynn</surname>
          </string-name>
          , M.T.:
          <article-title>Soundness of workflow nets: classification, decidability, and analysis</article-title>
          .
          <source>Formal Aspects of Computing</source>
          <volume>23</volume>
          (
          <issue>3</issue>
          ),
          <fpage>333</fpage>
          -
          <lpage>363</lpage>
          (
          <year>2011</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Adriansyah</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          :
          <article-title>Aligning observed and modeled behavior (</article-title>
          <year>2014</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Adriansyah</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Sidorova</surname>
          </string-name>
          , N.,
          <string-name>
            <surname>van Dongen</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          :
          <article-title>Cost-based fitness in conformance checking</article-title>
          . In: Application of Concurrency to System
          <source>Design (ACSD)</source>
          ,
          <year>2011</year>
          11th International Conference on. pp.
          <fpage>57</fpage>
          -
          <lpage>66</lpage>
          . IEEE (
          <year>2011</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7. van den Broucke,
          <string-name>
            <given-names>S.K.</given-names>
            ,
            <surname>Munoz-Gama</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            ,
            <surname>Carmona</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            ,
            <surname>Baesens</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            ,
            <surname>Vanthienen</surname>
          </string-name>
          , J.:
          <article-title>Event-based real-time decomposed conformance analysis</article-title>
          . In: OTM Confederated International Conferences”
          <article-title>On the Move to Meaningful Internet Systems”</article-title>
          . pp.
          <fpage>345</fpage>
          -
          <lpage>363</lpage>
          . Springer (
          <year>2014</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>Carmona</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Dongen</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Solti</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Weidlich</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          : Conformance Checking:
          <source>Relating Processes and Models</source>
          . Springer (
          <year>2018</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>Kerremans</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          :
          <article-title>Gartner Market Guide for Process Mining</article-title>
          , Research Note G00353970 (
          <year>2018</year>
          ), www.gartner.com
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <surname>Lee</surname>
            ,
            <given-names>W.L.J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Verbeek</surname>
            ,
            <given-names>H.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Munoz-Gama</surname>
          </string-name>
          , J., van der Aalst, W., Sepu´lveda, M.:
          <article-title>Recomposing conformance: Closing the circle on decomposed alignment-based conformance checking in process mining</article-title>
          .
          <source>Information Sciences</source>
          <volume>466</volume>
          ,
          <fpage>55</fpage>
          -
          <lpage>91</lpage>
          (
          <year>2018</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11. Mart´ınez, J.,
          <string-name>
            <surname>Silva</surname>
            ,
            <given-names>M.:</given-names>
          </string-name>
          <article-title>A simple and fast algorithm to obtain all invariants of a generalised Petri net</article-title>
          .
          <source>In: Application and Theory of Petri nets</source>
          , pp.
          <fpage>301</fpage>
          -
          <lpage>310</lpage>
          . Springer (
          <year>1982</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          12.
          <string-name>
            <surname>Miyamoto</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kumagai</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          :
          <article-title>Calculating place capacity for Petri nets using unfoldings</article-title>
          . In: Application of Concurrency to System Design,
          <year>1998</year>
          . Proceedings., 1998 International Conference on. pp.
          <fpage>143</fpage>
          -
          <lpage>151</lpage>
          . IEEE (
          <year>1998</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          13.
          <string-name>
            <surname>Munoz-Gama</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Carmona</surname>
          </string-name>
          , J., van der Aalst, W.:
          <article-title>Conformance checking in the large: Partitioning and topology</article-title>
          .
          <source>In: Business Process Management</source>
          , pp.
          <fpage>130</fpage>
          -
          <lpage>145</lpage>
          . Springer (
          <year>2013</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          14.
          <string-name>
            <surname>Munoz-Gama</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Carmona</surname>
          </string-name>
          , J., van der Aalst, W.:
          <article-title>Single-entry single-exit decomposed conformance checking</article-title>
          .
          <source>Information Systems</source>
          <volume>46</volume>
          ,
          <fpage>102</fpage>
          -
          <lpage>122</lpage>
          (
          <year>2014</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          15.
          <string-name>
            <surname>Rogge-Solti</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Senderovich</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Weidlich</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Mendling</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Gal</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          :
          <article-title>In log and model we trust? a generalized conformance checking framework</article-title>
          .
          <source>In: International Conference on Business Process Management</source>
          . pp.
          <fpage>179</fpage>
          -
          <lpage>196</lpage>
          . Springer (
          <year>2016</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          16.
          <string-name>
            <surname>Rozinat</surname>
          </string-name>
          , A.,
          <string-name>
            <surname>van der Aalst</surname>
          </string-name>
          , W.:
          <article-title>Conformance testing: measuring the alignment between event logs and process models</article-title>
          .
          <source>Citeseer</source>
          (
          <year>2005</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          17.
          <string-name>
            <surname>Rozinat</surname>
          </string-name>
          , A.,
          <string-name>
            <surname>van der Aalst</surname>
          </string-name>
          , W.:
          <article-title>Conformance checking of processes based on monitoring real behavior</article-title>
          .
          <source>Information Systems</source>
          <volume>33</volume>
          (
          <issue>1</issue>
          ),
          <fpage>64</fpage>
          -
          <lpage>95</lpage>
          (
          <year>2008</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          18.
          <string-name>
            <surname>Taymouri</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Carmona</surname>
            ,
            <given-names>J.:</given-names>
          </string-name>
          <article-title>A recursive paradigm for aligning observed behavior of large structured process models</article-title>
          .
          <source>In: International Conference on Business Process Management</source>
          . pp.
          <fpage>197</fpage>
          -
          <lpage>214</lpage>
          . Springer (
          <year>2016</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>