推断日志/模型的任何两个活动之间的关系。
- 直接跟随关系(>):活动B紧随A。A在前,B在后 (dfg)
- 直接被跟随关系(<):活动A紧随B。B在前,A在后 (sequence)
- 并行行为(||):可能是A后面跟着B,B后面跟着A (parallel)

import os
from pm4py.objects.log.importer.xes import importer
from pm4py.algo.filtering.log.variants import variants_filter
from pm4py.algo.discovery.inductive import algorithm as inductive_miner
from pm4py.objects.conversion.process_tree import converter
from pm4py.algo.discovery.footprints import algorithm as footprints_discovery
from pm4py.algo.conformance.footprints import algorithm as footprints_conformance
from pm4py.visualization.footprints import visualizer as fp_visualizer
from examples import examples_conf
if __name__ == "__main__":
# import a log
log = importer.apply(os.path.join("..", "tests", "input_data", "receipt.xes"))
# found a filtered version of the log that is used to discover a process model
filtered_log = variants_filter.filter_log_variants_percentage(log, 0.2)
# discover a process tree using inductive miner
tree = inductive_miner.apply(filtered_log)
print(tree)
# apply the conversion of a process tree into a Petri net
net, im, fm = converter.apply(tree)
# Footprints discovery: discover a list of footprints
# for all the cases of the log
fp_log = footprints_discovery.apply(log)
# discover the footpritns from the Petri net
fp_net = footprints_discovery.apply(net, im)
# finds the footprints for the entire log (not case-by-case, but taking
# the relations that appear inside the entire log)
fp_log_entire = footprints_discovery.apply(log, variant=footprints_discovery.Variants.ENTIRE_EVENT_LOG)
# visualize the footprint table
gviz = fp_visualizer.apply(fp_log_entire, fp_net, parameters={"format": examples_conf.TARGET_IMG_FORMAT})
fp_visualizer.view(gviz)
# discover the footpritns from the process tree
fp_tree = footprints_discovery.apply(tree)
print(len(fp_tree["sequence"]), len(fp_tree["parallel"]), len(fp_net["sequence"]), len(fp_net["parallel"]))
print(fp_tree["sequence"] == fp_net["sequence"] and fp_tree["parallel"] == fp_net["parallel"])
# apply the footprints conformance checking
conf = footprints_conformance.apply(fp_log, fp_net)
i = 0
for trace_an in conf:
if trace_an:
# print the first anomalous trace (containing deviations
# that are contained in the trace but not allowed by the model
print(log[i].attributes['concept:name'])
print(trace_an)
i = i + 1
本文介绍了如何使用PM4Py库对事件日志中的活动进行关系分析,包括直接跟随关系、并行行为的发现,以及通过诱导式挖掘发现过程模型。之后,文章展示了足迹发现和一致性检查的方法,以评估日志与模型的符合度。
562

被折叠的 条评论
为什么被折叠?



