From 4857f08577427783f8aed6e87586ca3a7d618a4d Mon Sep 17 00:00:00 2001 From: nwickel Date: Fri, 22 Mar 2024 12:10:46 +0100 Subject: [PATCH] Removed python scripts for process mining for clusters --- code/08_infos-clusters.py | 45 ------------------------------------ code/13_pm-case-clusters.py | 46 ------------------------------------- 2 files changed, 91 deletions(-) delete mode 100644 code/08_infos-clusters.py delete mode 100644 code/13_pm-case-clusters.py diff --git a/code/08_infos-clusters.py b/code/08_infos-clusters.py deleted file mode 100644 index fcb390f..0000000 --- a/code/08_infos-clusters.py +++ /dev/null @@ -1,45 +0,0 @@ -# 08_infos-clusters.py -# -# content: (1) Load data and create event log -# (2) Infos for clusters -# (3) Process maps for clusters -# -# input: results/haum/eventlogs_pre-corona_item-clusters.csv -# output: results/haum/pn_infos_clusters.csv -# -# last mod: 2024-03-06 - -import pm4py -import pandas as pd - -from python_helpers import eval_pm, pn_infos - -#--------------- (1) Load data and create event logs --------------- - -dat = pd.read_csv("results/haum/eventlogs_pre-corona_item-clusters.csv", sep = ";") - -log_path = pm4py.format_dataframe(dat, case_id = "path", activity_key = "event", - timestamp_key = "date.start") - -#--------------- (2) Infos for clusters --------------- - -# Merge clusters into data frame -eval = pd.DataFrame(columns = ["fitness", "precision", "generalizability", - "simplicity", "sound", "narcs", "ntrans", - "nplaces", "nvariants", "mostfreq"]) -for cluster in log_path.grp.unique().tolist(): - eval = pd.concat([eval, pn_infos(log_path, "grp", cluster)]) -eval = eval.sort_index() - -eval.to_csv("results/haum/pn_infos_clusters.csv", sep = ";") - -#--------------- (3) Process maps for clusters --------------- - -for cluster in log_path.grp.unique().tolist(): - subdata = log_path[log_path.grp == cluster] - subnet, subim, subfm = pm4py.discover_petri_net_inductive(subdata, noise_threshold=0.5) - pm4py.save_vis_petri_net(subnet, subim, subfm, - "results/processmaps/petrinet_cluster" + str(cluster).zfill(3) + ".png") - bpmn = pm4py.convert.convert_to_bpmn(subnet, subim, subfm) - pm4py.vis.save_vis_bpmn(bpmn, "results/processmaps/bpmn_cluster_" + - str(cluster).zfill(3) + ".png") diff --git a/code/13_pm-case-clusters.py b/code/13_pm-case-clusters.py deleted file mode 100644 index 80f809a..0000000 --- a/code/13_pm-case-clusters.py +++ /dev/null @@ -1,46 +0,0 @@ -# 12_pm-case-clusters.py -# -# content: (1) Load data and create event log -# (2) Infos for clusters -# (3) Process maps for clusters -# -# input: results/haum/eventlogs_pre-corona_item-clusters.csv -# output: results/haum/pn_infos_clusters.csv -# -# last mod: 2024-03-10 - -import pm4py -import pandas as pd - -from python_helpers import eval_pm, pn_infos - -#--------------- (1) Load data and create event logs --------------- - -dat = pd.read_csv("results/haum/eventlogs_2019_case-clusters_new.csv", sep = ";") - -event_log = pm4py.format_dataframe(dat, case_id = "case", activity_key = "event_new", - timestamp_key = "date.start") - -#--------------- (2) Infos for clusters --------------- - -# Merge clusters into data frame -eval = pd.DataFrame(columns = ["fitness", "precision", "generalizability", - "simplicity", "sound", "narcs", "ntrans", - "nplaces", "nvariants", "mostfreq"]) -for cluster in event_log.cluster.unique().tolist(): - eval = pd.concat([eval, pn_infos(event_log, "cluster", cluster)]) -eval = eval.sort_index() - -eval.to_csv("results/haum/pn_infos_clusters.csv", sep = ";") - -#--------------- (3) Process maps for clusters --------------- - -for cluster in event_log.cluster.unique().tolist(): - subdata = event_log[event_log.cluster == cluster] - subnet, subim, subfm = pm4py.discover_petri_net_inductive(subdata, noise_threshold = .7) - pm4py.save_vis_petri_net(subnet, subim, subfm, - "results/processmaps/petrinet_cluster" + str(cluster) + "_cases.png") - bpmn = pm4py.convert.convert_to_bpmn(subnet, subim, subfm) - pm4py.vis.save_vis_bpmn(bpmn, "results/processmaps/bpmn_cluster" + - str(cluster) + "_cases.png") -