Skip to content

Commit 23f4cb2

Browse files
Merge remote-tracking branch 'upstream/hotfixes' into release
2 parents 1f6d58b + 1d4e0e3 commit 23f4cb2

File tree

8 files changed

+230
-112
lines changed

8 files changed

+230
-112
lines changed

docs/source/api.rst

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ The following conversions are currently available:
6565
* :meth:`pm4py.convert.convert_to_bpmn` converts a process model to BPMN
6666
* :meth:`pm4py.convert.convert_to_petri_net` converts a process model to a Petri net
6767
* :meth:`pm4py.convert.convert_to_process_tree` converts a process model to a process tree
68+
* :meth:`pm4py.convert.convert_to_powl` converts a process model to a POWL model
6869
* :meth:`pm4py.convert.convert_to_reachability_graph` converts a process model to a reachability graph
6970
* :meth:`pm4py.convert.convert_log_to_ocel` converts an event log to an object-centric event log
7071
* :meth:`pm4py.convert.convert_log_to_networkx` converts a traditional event log (dataframe) to a directed graph (NetworkX)
@@ -402,8 +403,14 @@ Other algorithms, which do not belong to the aforementioned categories, are coll
402403
* :meth:`pm4py.analysis.reduce_petri_net_invisibles`; reduces the invisible transitions of a Petri net when possible.
403404
* :meth:`pm4py.analysis.reduce_petri_net_implicit_places`; reduces the implicit places in the Petri net (using MURATA).
404405
* :meth:`pm4py.analysis.get_enabled_transitions`; gets the transitions enabled in a given marking.
405-
406-
406+
* :meth:`pm4py.analysis.simplicity_petri_net`; computes the simplicity metric on the given Petri net.
407+
* :meth:`pm4py.analysis.behavioral_similarity`; computes the behavioral similarity between two process models.
408+
* :meth:`pm4py.analysis.structural_similarity`; computes the structural similarity between two process models.
409+
* :meth:`pm4py.analysis.embeddings_similarity`; computes the embeddings similarity between two process models.
410+
* :meth:`pm4py.analysis.label_sets_similarity`; computes the label-sets-similarity between two process models.
411+
* :meth:`pm4py.analysis.get_activity_labels`; gets the activity labels from the given event log or process model.
412+
* :meth:`pm4py.analysis.replace_activity_labels`; uses a substitution dictionary to replace the names of the activities in the process model.
413+
* :meth:`pm4py.analysis.map_labels_from_second_model`; maps the activity labels of the second process model on top of the first.
407414

408415

409416
List of Methods
@@ -451,6 +458,7 @@ List of Methods
451458
pm4py.convert.convert_ocel_to_networkx
452459
pm4py.convert.convert_petri_net_to_networkx
453460
pm4py.convert.convert_petri_net_type
461+
pm4py.convert.convert_to_powl
454462
pm4py.discovery
455463
pm4py.discovery.discover_dfg
456464
pm4py.discovery.discover_performance_dfg
@@ -670,6 +678,14 @@ List of Methods
670678
pm4py.analysis.reduce_petri_net_invisibles
671679
pm4py.analysis.reduce_petri_net_implicit_places
672680
pm4py.analysis.get_enabled_transitions
681+
pm4py.analysis.simplicity_petri_net
682+
pm4py.analysis.behavioral_similarity
683+
pm4py.analysis.structural_similarity
684+
pm4py.analysis.embeddings_similarity
685+
pm4py.analysis.get_activity_labels
686+
pm4py.analysis.replace_activity_labels
687+
pm4py.analysis.label_sets_similarity
688+
pm4py.analysis.map_labels_from_second_model
673689
pm4py.utils
674690
pm4py.utils.rebase
675691
pm4py.utils.parse_process_tree

examples/bpmn_merging.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,7 @@ def print_bpmn_summary(bpmn, name):
202202
print(f" - {flow.get_source().get_name()} -> {flow.get_target().get_name()}")
203203

204204

205-
# Main execution
206-
if __name__ == "__main__":
205+
def execute_script():
207206
# Create the main BPMN with swimlanes
208207
main_bpmn = create_manual_bpmn_with_swimlanes()
209208

@@ -231,3 +230,8 @@ def print_bpmn_summary(bpmn, name):
231230
print_bpmn_summary(merged_bpmn, "Merged BPMN with Swimlanes")
232231

233232
pm4py.view_bpmn(merged_bpmn, format="svg")
233+
234+
235+
# Main execution
236+
if __name__ == "__main__":
237+
execute_script()

examples/execute_everything.py

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,30 @@ def cost_based_dfg():
179179
cost_based_dfg.execute_script()
180180

181181

182+
def bpmn_merging():
183+
from examples import bpmn_merging
184+
print("\n\nbpmn_merging")
185+
bpmn_merging.execute_script()
186+
187+
188+
def label_replacement():
189+
from examples import label_replacement
190+
print("\n\nlabel_replacement")
191+
label_replacement.execute_script()
192+
193+
194+
def model_to_model_sim():
195+
from examples import model_to_model_sim
196+
print("\n\nmodel_to_model_sim")
197+
model_to_model_sim.execute_script()
198+
199+
200+
def monte_carlo_example():
201+
from examples import monte_carlo_example
202+
print("\n\nmonte_carlo_example")
203+
monte_carlo_example.execute_script()
204+
205+
182206
def df_to_log_postpro():
183207
from examples import df_to_log_postpro
184208
print("\n\ndf_to_log_postpro")
@@ -1032,7 +1056,7 @@ def main():
10321056
execute_script(link_analysis_vbfa)
10331057
execute_script(ocel_streaming)
10341058
execute_script(petri_manual_generation)
1035-
#execute_script(timestamp_interleavings)
1059+
execute_script(timestamp_interleavings)
10361060
execute_script(object_centric_petri_net_discovery)
10371061
execute_script(trans_system_stochastic_view)
10381062
execute_script(network_analysis)
@@ -1091,8 +1115,8 @@ def main():
10911115
execute_script(streaming_discovery_dfg)
10921116
execute_script(streaming_xes_reader_event_stream)
10931117
execute_script(streaming_xes_reader_trace_stream)
1094-
#execute_script(monte_carlo_dfg)
1095-
#execute_script(monte_carlo_petri_net)
1118+
execute_script(monte_carlo_dfg)
1119+
execute_script(monte_carlo_petri_net)
10961120

10971121
print_versions()
10981122

examples/label_replacement.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import pm4py
2+
import os
3+
4+
5+
def execute_script():
6+
log = pm4py.read_xes(os.path.join("..", "tests", "input_data", "running-example.xes"))
7+
8+
# discovers a process moedl from the log
9+
process_tree = pm4py.discover_process_tree_inductive(log)
10+
# gets the label from the process models
11+
labels = pm4py.get_activity_labels(process_tree)
12+
# modify the labels
13+
labels = {x: x+"ADD" for x in labels}
14+
15+
# replace the labels on the process model
16+
process_tree_mod = pm4py.replace_activity_labels(labels, process_tree)
17+
# view the modified process tree
18+
pm4py.view_process_tree(process_tree_mod, format="svg")
19+
20+
# now, let's replace the labels back, with labels projection from another process model
21+
process_tree_mod2 = pm4py.map_labels_from_second_model(process_tree_mod, process_tree)
22+
# show the process tree modified
23+
pm4py.view_process_tree(process_tree_mod2, format="svg")
24+
25+
26+
if __name__ == "__main__":
27+
execute_script()

examples/model_to_model_sim.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import pm4py
2+
import os
3+
import traceback
4+
5+
6+
def execute_script():
7+
log = pm4py.read_xes(os.path.join("..", "tests", "input_data", "receipt.xes"))
8+
9+
# can be anything here :))
10+
process_tree = pm4py.discover_process_tree_inductive(log)
11+
12+
# can be anything here too :)))
13+
powl = pm4py.discover_powl(pm4py.filter_variants_top_k(log, 20))
14+
15+
# computes the footprints-based behavioral similarity between a process tree
16+
# and a POWL model
17+
behavioral_similarity = pm4py.behavioral_similarity(powl, process_tree)
18+
print("behavioral similarity", behavioral_similarity)
19+
20+
# computes the structural similarity between a POWL and a process tree
21+
structural_similarity = pm4py.structural_similarity(process_tree, powl)
22+
print("structural similarity", structural_similarity)
23+
24+
# computes the label-sets-similarity between a process tree and a POWL
25+
label_sets_similarity = pm4py.label_sets_similarity(powl, process_tree)
26+
print("label sets similarity", label_sets_similarity)
27+
28+
try:
29+
# computes the embeddings-based similarity between a process tree and a POWL
30+
embeddings_similarity = pm4py.embeddings_similarity(powl, process_tree)
31+
print("embeddings similarity", embeddings_similarity)
32+
33+
# embeddings are non-deterministic, so even comparing a model with itself,
34+
# it would probably give a value below 1
35+
embeddings_similarity2 = pm4py.embeddings_similarity(process_tree, process_tree)
36+
print("embeddings similarity", embeddings_similarity2)
37+
except:
38+
traceback.print_exc()
39+
40+
41+
if __name__ == "__main__":
42+
execute_script()

0 commit comments

Comments
 (0)