Frequency/Performance

Adding frequency or performance information to Petri nets

Similar to the Directly-Follows graph, it is also possible to decorate the Petri net with frequency or performance information. This is done by using a replay technique on the model and then assigning frequency/performance to the paths. The variant parameter of the factory specifies which annotation should be used. The values for the variant parameter are the following:

  • wo_decoration: This is the default value and indicates that the Petri net is not decorated.
  • frequency: This indicates that the model should be decorated according to frequency information obtained by applying replay.
  • performance: This indicates that the model should be decorated according to performance (aggregated by mean) information obtained by applying replay.

In the case the frequency and performance decoration are chosen, it is required to pass the log as a parameter of the visualization (it needs to be replayed).

The following code can be used to obtain the Petri net mined by the Inductive Miner decorated with frequency information:

from pm4py.visualization.petrinet import factory as pn_vis_factory

parameters = {"format":"png"}
gviz = pn_vis_factory.apply(net, initial_marking, final_marking, parameters=parameters, variant="frequency", log=log)
pn_vis_factory.save(gviz, "inductive_frequency.png")

Changing the variant to performance, we obtain the following process schema: