2024-03-06 17:59:22 +01:00
|
|
|
# 06_infos-items.py
|
|
|
|
#
|
|
|
|
# content: (1) Load data and create event log
|
|
|
|
# (2) Infos for items
|
|
|
|
#
|
2024-04-17 14:25:04 +02:00
|
|
|
# input: ../results/eventlogs_pre-corona_cleaned.csv
|
|
|
|
# output: ../results/pn_infos_items.csv
|
2024-03-06 17:59:22 +01:00
|
|
|
#
|
2024-04-17 14:25:04 +02:00
|
|
|
# last mod: 2024-04-17
|
2024-03-06 17:59:22 +01:00
|
|
|
|
2024-01-25 17:21:18 +01:00
|
|
|
import pm4py
|
|
|
|
import pandas as pd
|
|
|
|
import numpy as np
|
|
|
|
|
|
|
|
from python_helpers import eval_pm, pn_infos
|
|
|
|
|
2024-03-06 17:59:22 +01:00
|
|
|
#--------------- (1) Load data and create event logs ---------------
|
2024-01-25 17:21:18 +01:00
|
|
|
|
2024-04-17 14:25:04 +02:00
|
|
|
dat = pd.read_csv("../results/eventlogs_pre-corona_cleaned", sep = ";")
|
2024-01-25 17:21:18 +01:00
|
|
|
|
|
|
|
log_path = pm4py.format_dataframe(dat, case_id = "path", activity_key = "event",
|
2024-03-06 17:59:22 +01:00
|
|
|
timestamp_key = "date.start")
|
2024-01-25 17:21:18 +01:00
|
|
|
|
2024-03-06 17:59:22 +01:00
|
|
|
#--------------- (2) Infos for items ---------------
|
2024-01-25 17:21:18 +01:00
|
|
|
|
2024-01-30 11:48:48 +01:00
|
|
|
eval = pd.DataFrame(columns = ["fitness", "precision", "generalizability",
|
|
|
|
"simplicity", "sound", "narcs", "ntrans",
|
|
|
|
"nplaces", "nvariants", "mostfreq"])
|
2024-03-06 17:59:22 +01:00
|
|
|
|
2024-01-25 17:21:18 +01:00
|
|
|
for item in log_path.item.unique().tolist():
|
2024-01-30 11:48:48 +01:00
|
|
|
eval = pd.concat([eval, pn_infos(log_path, "item", item)])
|
2024-03-06 17:59:22 +01:00
|
|
|
|
2024-01-30 11:48:48 +01:00
|
|
|
eval = eval.sort_index()
|
2024-01-25 17:21:18 +01:00
|
|
|
|
|
|
|
# Export
|
2024-04-17 14:25:04 +02:00
|
|
|
eval.to_csv("../results/pn_infos_items.csv", sep = ";")
|
2024-03-06 17:59:22 +01:00
|
|
|
|