mtt_haum/code/06_infos-items.py

38 lines
1.1 KiB
Python

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