def main(): real_log = import_xes("data/benchmark/GTlog-11.xes", "concept:name") model_log = generate_playout( *import_petri_net("data/benchmark/alpha-11.pnml"), "concept:name") result = Act2VecWmdConformance().execute(model_log, real_log) print(result.calc_precision()) print(result.calc_fitness())
def load(variant, id): if variant in ["alpha", "ilp", "ind0", "ind1", "PN"]: ext = "pnml" else: ext = "xes" path = os.path.join("data", "benchmark", "%s-%d.%s" % (variant, id, ext)) if ext == "pnml": return cc.generate_playout(*cc.import_petri_net(path), "concept:name") else: return cc.import_xes(path, "concept:name")
import os from conformance_checking import import_xes, import_petri_net, generate_playout if __name__ == "__main__": absPath = os.path.abspath(__file__) fileDir = os.path.dirname(absPath) code = os.path.dirname(fileDir) data = os.path.join(code, "data") print("Running the import_xes() Method to import an event log...") log_data = import_xes(os.path.join(data, "log_test.xes"), "concept:name") print(""" The output of the method is a List[List[str]], where the entry i,j is the j-th activity name of the i-th trace.""") print("Output: ", log_data) print("Running the import_petri_net() Method to import a petri net...") net, im, fm = import_petri_net(os.path.join(data, "petri_net_small.pnml")) print("Aquired a petri net, an initial marking and a final marking.") print( "Running the generate_playout() Method to generate a playout of the petri net..." ) playout = generate_playout(net, im, fm, "concept:name") print("""The output of the method is a List[List[str]], where the entry i,j is the j-th activity name of the i-th trace.""") print("Output (only first 10): ", playout[:10])
from conformance_checking.embedding.embedding_generator import ( ActivityEmbeddingGenerator, TraceEmbeddingGenerator, ) from conformance_checking import import_xes import os if __name__ == "__main__": # load a log with our importer absPath = os.path.abspath(__file__) fileDir = os.path.dirname(absPath) code = os.path.dirname(fileDir) data = os.path.join(code, "data") log = import_xes( os.path.join(data, "BPI_Challenge_2012.xes"), "concept:name", limit=2000 ) """ example for generating each activity and trace embeddings """ act_emb_gen = ActivityEmbeddingGenerator(log, act2vec_windows_size=4, num_ns=4) # start training manually act_emb_gen.start_training() trace_emb_gen = TraceEmbeddingGenerator( log, trace2vec_windows_size=4, auto_train=True ) # create example model and real log
def test_import_xes(): assert import_xes(os.path.join(data, "log_test.xes"), "concept:name") == [ ["register request", "examine casually", "check ticket"], ["register request", "decide"], ], str(data)