Spaces:
Running
Running
Andrea Maldonado
commited on
Commit
·
222513d
1
Parent(s):
b49ce56
Adds log_counter to benchmarking test for correct json dump
Browse files- tag/benchmark.py +3 -6
tag/benchmark.py
CHANGED
@@ -6,6 +6,7 @@ import subprocess
|
|
6 |
|
7 |
from datetime import datetime as dt
|
8 |
from functools import partial, partialmethod
|
|
|
9 |
from pathlib import Path
|
10 |
from pm4py import read_xes, convert_to_bpmn, read_bpmn, convert_to_petri_net, check_soundness
|
11 |
from pm4py import discover_petri_net_inductive, discover_petri_net_ilp, discover_petri_net_heuristics
|
@@ -48,7 +49,7 @@ class BenchmarkTest:
|
|
48 |
#self.benchmark_wrapper((event_logs[0],0), miners=self.params[MINERS])# TESTING
|
49 |
with multiprocessing.Pool(num_cores) as p:
|
50 |
print(f"INFO: Benchmark starting at {start.strftime('%H:%M:%S')} using {num_cores} cores for {len(event_logs)} files...")
|
51 |
-
p.
|
52 |
|
53 |
# Aggregates metafeatures in saved Jsons into dataframe
|
54 |
self.root_path = self.params[INPUT_PATH]
|
@@ -77,10 +78,7 @@ class BenchmarkTest:
|
|
77 |
f" and {len(benchmark_results)} event-logs. Saved benchmark to {self.filepath}.")
|
78 |
print("========================= ~ BenchmarkTest =============================")
|
79 |
|
80 |
-
def benchmark_wrapper(self, event_log, miners=['inductive']):
|
81 |
-
log_counter = event_log[1]
|
82 |
-
event_log = event_log[0]
|
83 |
-
|
84 |
dump_path = os.path.join(self.params[OUTPUT_PATH],
|
85 |
os.path.split(self.params[INPUT_PATH])[-1])
|
86 |
dump_path= os.path.join(self.params[OUTPUT_PATH],
|
@@ -90,7 +88,6 @@ class BenchmarkTest:
|
|
90 |
dump_path = os.path.split(dump_path)[0]
|
91 |
|
92 |
benchmark_results = pd.DataFrame()
|
93 |
-
# TODO: Use iteratevely generated name for log name in dataframe for passed unnamed logs instead of whole log. E.g. gen_el_1, gen_el_2,...
|
94 |
if isinstance(event_log, str):
|
95 |
log_name = event_log.replace(".xes", "")
|
96 |
results = {'log': log_name}
|
|
|
6 |
|
7 |
from datetime import datetime as dt
|
8 |
from functools import partial, partialmethod
|
9 |
+
from itertools import repeat
|
10 |
from pathlib import Path
|
11 |
from pm4py import read_xes, convert_to_bpmn, read_bpmn, convert_to_petri_net, check_soundness
|
12 |
from pm4py import discover_petri_net_inductive, discover_petri_net_ilp, discover_petri_net_heuristics
|
|
|
49 |
#self.benchmark_wrapper((event_logs[0],0), miners=self.params[MINERS])# TESTING
|
50 |
with multiprocessing.Pool(num_cores) as p:
|
51 |
print(f"INFO: Benchmark starting at {start.strftime('%H:%M:%S')} using {num_cores} cores for {len(event_logs)} files...")
|
52 |
+
p.starmap(self.benchmark_wrapper, zip(event_logs, log_counter, repeat(self.params[MINERS])))
|
53 |
|
54 |
# Aggregates metafeatures in saved Jsons into dataframe
|
55 |
self.root_path = self.params[INPUT_PATH]
|
|
|
78 |
f" and {len(benchmark_results)} event-logs. Saved benchmark to {self.filepath}.")
|
79 |
print("========================= ~ BenchmarkTest =============================")
|
80 |
|
81 |
+
def benchmark_wrapper(self, event_log, log_counter=0, miners=['inductive']):
|
|
|
|
|
|
|
82 |
dump_path = os.path.join(self.params[OUTPUT_PATH],
|
83 |
os.path.split(self.params[INPUT_PATH])[-1])
|
84 |
dump_path= os.path.join(self.params[OUTPUT_PATH],
|
|
|
88 |
dump_path = os.path.split(dump_path)[0]
|
89 |
|
90 |
benchmark_results = pd.DataFrame()
|
|
|
91 |
if isinstance(event_log, str):
|
92 |
log_name = event_log.replace(".xes", "")
|
93 |
results = {'log': log_name}
|