Spaces:
Sleeping
Sleeping
File size: 3,279 Bytes
8097001 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
import os
import unittest
from pm4py.algo.discovery.heuristics import algorithm as heuristics_miner
from pm4py.objects.log.util import dataframe_utils
from pm4py.objects.log.importer.xes import importer as xes_importer
from pm4py.visualization.heuristics_net import visualizer as hn_vis
from pm4py.visualization.petri_net import visualizer as pn_vis
from pm4py.util import constants, pandas_utils
from tests.constants import INPUT_DATA_DIR
class HeuMinerTest(unittest.TestCase):
def test_heunet_running_example(self):
# to avoid static method warnings in tests,
# that by construction of the unittest package have to be expressed in such way
self.dummy_variable = "dummy_value"
log = xes_importer.apply(os.path.join(INPUT_DATA_DIR, "running-example.xes"))
heu_net = heuristics_miner.apply_heu(log)
gviz = hn_vis.apply(heu_net)
del gviz
def test_petrinet_running_example(self):
# to avoid static method warnings in tests,
# that by construction of the unittest package have to be expressed in such way
self.dummy_variable = "dummy_value"
log = xes_importer.apply(os.path.join(INPUT_DATA_DIR, "running-example.xes"))
net, im, fm = heuristics_miner.apply(log)
gviz = pn_vis.apply(net, im, fm)
del gviz
def test_petrinet_receipt_df(self):
# to avoid static method warnings in tests,
# that by construction of the unittest package have to be expressed in such way
self.dummy_variable = "dummy_value"
df = pandas_utils.read_csv(os.path.join(INPUT_DATA_DIR, "receipt.csv"))
df = dataframe_utils.convert_timestamp_columns_in_df(df, timest_format=constants.DEFAULT_TIMESTAMP_PARSE_FORMAT)
net, im, fm = heuristics_miner.apply(df)
gviz = pn_vis.apply(net, im, fm)
del gviz
def test_heuplusplus_perf_df(self):
df = pandas_utils.read_csv(os.path.join(INPUT_DATA_DIR, "interval_event_log.csv"))
df = dataframe_utils.convert_timestamp_columns_in_df(df, timest_format=constants.DEFAULT_TIMESTAMP_PARSE_FORMAT)
heu_net = heuristics_miner.Variants.PLUSPLUS.value.apply_heu_pandas(df, parameters={"heu_net_decoration": "performance"})
gviz = hn_vis.apply(heu_net)
def test_heuplusplus_perf_log(self):
log = xes_importer.apply(os.path.join(INPUT_DATA_DIR, "interval_event_log.xes"))
heu_net = heuristics_miner.apply_heu(log, variant=heuristics_miner.Variants.PLUSPLUS, parameters={"heu_net_decoration": "performance"})
gviz = hn_vis.apply(heu_net)
def test_heuplusplus_petri_df(self):
df = pandas_utils.read_csv(os.path.join(INPUT_DATA_DIR, "interval_event_log.csv"))
df = dataframe_utils.convert_timestamp_columns_in_df(df, timest_format=constants.DEFAULT_TIMESTAMP_PARSE_FORMAT)
net, im, fm = heuristics_miner.Variants.PLUSPLUS.value.apply_pandas(df)
gviz = pn_vis.apply(net, im, fm)
def test_heuplusplus_petri_log(self):
log = xes_importer.apply(os.path.join(INPUT_DATA_DIR, "interval_event_log.xes"))
net, im, fm = heuristics_miner.apply(log, variant=heuristics_miner.Variants.PLUSPLUS)
gviz = pn_vis.apply(net, im, fm)
if __name__ == "__main__":
unittest.main()
|