예제 #1
0
def discover_tree_inductive(log, noise_threshold=0.0):
    """
    Discovers a process tree using the IMDFc algorithm

    Parameters
    --------------
    log
        Event log
    noise_threshold
        Noise threshold (default: 0.0)

    Returns
    --------------
    process_tree
        Process tree object
    """
    from pm4py.algo.discovery.inductive import algorithm as inductive_miner
    if noise_threshold > 0.0:
        return inductive_miner.apply_tree(
            log,
            variant=inductive_miner.Variants.IMf,
            parameters={
                inductive_miner.Variants.IMf.value.Parameters.NOISE_THRESHOLD:
                noise_threshold
            })
    else:
        return inductive_miner.apply_tree(
            log,
            variant=inductive_miner.Variants.IM,
            parameters={
                inductive_miner.Variants.IM.value.Parameters.NOISE_THRESHOLD:
                noise_threshold
            })
예제 #2
0
def discover_process_tree_inductive(
        log: Union[EventLog, pd.DataFrame],
        noise_threshold: float = 0.0) -> ProcessTree:
    """
    Discovers a process tree using the IM algorithm

    Parameters
    --------------
    log
        Event log
    noise_threshold
        Noise threshold (default: 0.0)

    Returns
    --------------
    process_tree
        Process tree object
    """
    from pm4py.algo.discovery.inductive import algorithm as inductive_miner
    if noise_threshold > 0:
        return inductive_miner.apply_tree(
            log,
            variant=inductive_miner.Variants.IMf,
            parameters={
                inductive_miner.Variants.IMf.value.Parameters.NOISE_THRESHOLD:
                noise_threshold
            })
    else:
        return inductive_miner.apply_tree(
            log,
            variant=inductive_miner.Variants.IM_CLEAN,
            parameters={
                inductive_miner.Variants.IM_CLEAN.value.Parameters.NOISE_THRESHOLD:
                noise_threshold
            })
예제 #3
0
def execute_script():
    log = xes_importer.apply(
        os.path.join("..", "tests", "input_data", "running-example.xes"))
    tree = inductive_miner.apply_tree(log)
    new_log_1 = tree_playout.apply(tree)
    print(len(new_log_1))
    new_tree_1 = inductive_miner.apply_tree(new_log_1)
    print(new_tree_1)
    new_log_2 = tree_playout.apply(tree,
                                   variant=tree_playout.Variants.EXTENSIVE)
    print(len(new_log_2))
    new_tree_2 = inductive_miner.apply_tree(new_log_2)
    print(new_tree_2)
예제 #4
0
def execute_script():
    log = importer.apply(os.path.join("..", "tests", "input_data", "running-example.xes"))
    tree = inductive_miner.apply_tree(log)
    gviz1 = pt_vis_factory.apply(tree, parameters={"format": "svg"})
    # pt_vis_factory.view(gviz1)
    gviz2 = pt_visualizer.apply(tree, parameters={pt_visualizer.Variants.WO_DECORATION.value.Parameters.FORMAT: "svg"})
    pt_visualizer.view(gviz2)
예제 #5
0
 def test_playout_tree_basic(self):
     log = xes_importer.apply(
         os.path.join("input_data", "running-example.xes"))
     from pm4py.algo.discovery.inductive import algorithm as inductive_miner
     tree = inductive_miner.apply_tree(log)
     from pm4py.simulation.tree_playout import algorithm as tree_playout
     new_log = tree_playout.apply(tree)
예제 #6
0
 def test_playout_tree_extensive(self):
     log = xes_importer.apply(
         os.path.join("input_data", "running-example.xes"))
     from pm4py.algo.discovery.inductive import algorithm as inductive_miner
     tree = inductive_miner.apply_tree(log)
     from pm4py.algo.simulation.playout.process_tree import algorithm as tree_playout
     new_log = tree_playout.apply(tree,
                                  variant=tree_playout.Variants.EXTENSIVE)
예제 #7
0
 def test_tree_receipt_log_infrequent_based(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, "receipt.xes"))
     tree = inductive_miner.apply_tree(log, variant=inductive_miner.IMf)
     gviz = pt_vis.apply(tree)
     del gviz
     del log
예제 #8
0
def execute_script():
    log_path = os.path.join(
        os.path.join("..", "tests", "input_data", "running-example.xes"))
    log = xes_import.apply(log_path)
    ptree = inductive_miner.apply_tree(log)
    bpmn = pt_converter.apply(ptree, variant=pt_converter.Variants.TO_BPMN)
    #bpmn = bpmn_layouter.apply(bpmn)
    bpmn_exporter.apply(bpmn, "stru.bpmn")
    os.remove("stru.bpmn")
예제 #9
0
 def test_footprints_tree(self):
     log = xes_importer.apply(os.path.join("input_data", "running-example.xes"))
     from pm4py.algo.discovery.inductive import algorithm as inductive_miner
     tree = inductive_miner.apply_tree(log)
     from pm4py.algo.discovery.footprints import algorithm as footprints_discovery
     fp_log = footprints_discovery.apply(log)
     fp_tree = footprints_discovery.apply(tree)
     from pm4py.algo.conformance.footprints import algorithm as footprints_conformance
     conf = footprints_conformance.apply(fp_log, fp_tree)
예제 #10
0
 def test_footprints_tree_df(self):
     df = csv_import_adapter.import_dataframe_from_path(
         os.path.join("input_data", "running-example.csv"))
     from pm4py.algo.discovery.inductive import algorithm as inductive_miner
     log = converter.apply(df)
     tree = inductive_miner.apply_tree(log)
     from pm4py.algo.discovery.footprints import algorithm as footprints_discovery
     fp_df = footprints_discovery.apply(df)
     fp_tree = footprints_discovery.apply(tree)
     from pm4py.algo.conformance.footprints import algorithm as footprints_conformance
     conf = footprints_conformance.apply(fp_df, fp_tree)
예제 #11
0
 def test_tree_running_example_dfg_based(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"))
     tree = inductive_miner.apply_tree(log, variant=inductive_miner.DFG_BASED)
     gviz = pt_vis.apply(tree)
     del gviz
     # test log generation
     log = pt_semantics.generate_log(tree)
     del log
예제 #12
0
 def test_footprints_tree_df(self):
     df = pd.read_csv(os.path.join("input_data", "running-example.csv"))
     df = dataframe_utils.convert_timestamp_columns_in_df(df)
     from pm4py.algo.discovery.inductive import algorithm as inductive_miner
     log = converter.apply(df)
     tree = inductive_miner.apply_tree(log)
     from pm4py.algo.discovery.footprints import algorithm as footprints_discovery
     fp_df = footprints_discovery.apply(df)
     fp_tree = footprints_discovery.apply(tree)
     from pm4py.algo.conformance.footprints import algorithm as footprints_conformance
     conf = footprints_conformance.apply(fp_df, fp_tree)
예제 #13
0
def execute_script():
    log_path = os.path.join("/Users/Julian/Documents/HiWi/PADS/EventLogs/BPI_Challenge_2012.xes")
    log = xes_import.apply(log_path)
    #log = keep_one_trace_per_variant(log)
    #log = log[15:30]
    ptree = ind_miner.apply_tree(log, parameters={Parameters.NOISE_THRESHOLD: 0.5}, variant=ind_miner.Variants.IMf)
    gviz = pt_vis.apply(ptree,
                        parameters={pt_vis.Variants.WO_DECORATION.value.Parameters.FORMAT: "svg"})


    net, im, fm = converter.apply(ptree)

    pt_vis.view(gviz)
예제 #14
0
def inductive_miner_petri_net(log):
    # create the process tree
    tree = inductive_miner.apply_tree(log)
    # convert the process tree to a petri net
    net, initial_marking, final_marking = pt_converter.apply(tree)
    find_fitness('induct', log, net, initial_marking, final_marking)
    parameters = {
        pn_visualizer.Variants.FREQUENCY.value.Parameters.FORMAT: "png"}
    gviz = pn_visualizer.apply(net, initial_marking, final_marking,
                               parameters=parameters,
                               variant=pn_visualizer.Variants.FREQUENCY,
                               log=log)
    return gviz, None
def discover_process_tree(log):
    """
    Given an event log, the function discovers the process tree using inductive miner algorithm. 
    
    Parameters:
        log (EventLog): Given event log
        
    Returns:
        tree (ProcessTree): The generated Process tree from the log
    """
    tree = inductive_miner.apply_tree(log)
    settings.PROCESS_TREE = tree
    return tree
예제 #16
0
 def test_footprints_tree(self):
     log = xes_importer.apply(os.path.join("input_data", "running-example.xes"))
     from pm4py.algo.discovery.inductive import algorithm as inductive_miner
     tree = inductive_miner.apply_tree(log)
     from pm4py.algo.discovery.footprints import algorithm as footprints_discovery
     fp_entire_log = footprints_discovery.apply(log, variant=footprints_discovery.Variants.ENTIRE_EVENT_LOG)
     fp_trace_trace = footprints_discovery.apply(log)
     fp_tree = footprints_discovery.apply(tree)
     from pm4py.algo.conformance.footprints import algorithm as footprints_conformance
     conf1 = footprints_conformance.apply(fp_entire_log, fp_tree)
     conf2 = footprints_conformance.apply(fp_trace_trace, fp_tree)
     conf3 = footprints_conformance.apply(fp_entire_log, fp_tree,
                                          variant=footprints_conformance.Variants.LOG_EXTENSIVE)
     conf4 = footprints_conformance.apply(fp_trace_trace, fp_tree,
                                          variant=footprints_conformance.Variants.TRACE_EXTENSIVE)
예제 #17
0
def discover_tree_inductive(log: EventLog, noise_threshold: float = 0.0) -> ProcessTree:
    warnings.warn('discover_tree_inductive is deprecated, use discover_process_tree_inductive', DeprecationWarning)
    """
    Discovers a process tree using the IMDFc algorithm

    Parameters
    --------------
    log
        Event log
    noise_threshold
        Noise threshold (default: 0.0)

    Returns
    --------------
    process_tree
        Process tree object
    """
    from pm4py.algo.discovery.inductive import algorithm as inductive_miner
    if noise_threshold > 0.0:
        return inductive_miner.apply_tree(log, variant=inductive_miner.Variants.IMf, parameters={
            inductive_miner.Variants.IMf.value.Parameters.NOISE_THRESHOLD: noise_threshold})
    else:
        return inductive_miner.apply_tree(log, variant=inductive_miner.Variants.IM, parameters={
            inductive_miner.Variants.IM.value.Parameters.NOISE_THRESHOLD: noise_threshold})
예제 #18
0
def execute_script():
    log_path = os.path.join("..", "tests", "input_data", "running-example.xes")

    log = xes_importer.apply(log_path)
    tree: ProcessTree = inductive.apply_tree(log)
    gviz = pt_vis.apply(
        tree,
        parameters={
            pt_vis.Variants.WO_DECORATION.value.Parameters.FORMAT: "svg"
        })
    pt_vis.view(gviz)

    print("start calculate approximated alignments")
    approx_alignments = align_approx.apply(log, tree)
    pretty_print_alignments(approx_alignments)
예제 #19
0
    def test_41(self):
        import os
        from pm4py.objects.log.importer.xes import importer as xes_importer
        from pm4py.algo.discovery.inductive import algorithm as inductive_miner

        log = xes_importer.apply(os.path.join("input_data", "running-example.xes"))
        net, initial_marking, final_marking = inductive_miner.apply(log)

        from pm4py.algo.discovery.inductive import algorithm as inductive_miner
        from pm4py.visualization.process_tree import visualizer as pt_visualizer

        tree = inductive_miner.apply_tree(log)

        gviz = pt_visualizer.apply(tree)

        from pm4py.objects.conversion.process_tree import converter as pt_converter
        net, initial_marking, final_marking = pt_converter.apply(tree, variant=pt_converter.Variants.TO_PETRI_NET)
예제 #20
0
def execute_script():
    # import a log
    log = importer.apply(
        os.path.join("..", "tests", "input_data", "receipt.xes"))
    # found a filtered version of the log that is used to discover a process model
    filtered_log = variants_filter.apply_auto_filter(deepcopy(log))
    # discover a process tree using inductive miner
    tree = inductive_miner.apply_tree(filtered_log)
    print(tree)
    # apply the conversion of a process tree into a Petri net
    net, im, fm = converter.apply(tree)
    # Footprints discovery: discover a list of footprints
    # for all the cases of the log
    fp_log = footprints_discovery.apply(log)
    # discover the footpritns from the process tree
    fp_tree = footprints_discovery.apply(tree)
    # discover the footpritns from the Petri net
    fp_net = footprints_discovery.apply(net, im)
    print(len(fp_tree["sequence"]), len(fp_tree["parallel"]),
          len(fp_net["sequence"]), len(fp_net["parallel"]))
    print(fp_tree["sequence"] == fp_net["sequence"]
          and fp_tree["parallel"] == fp_net["parallel"])
    # apply the footprints conformance checking
    conf = footprints_conformance.apply(fp_log, fp_net)
    for trace_an in conf:
        if trace_an:
            # print the first anomalous trace (containing deviations
            # that are contained in the trace but not allowed by the model)
            print(trace_an)
            break
    # finds the footprints for the entire log (not case-by-case, but taking
    # the relations that appear inside the entire log)
    fp_log_entire = footprints_discovery.apply(
        log, variant=footprints_discovery.Variants.ENTIRE_EVENT_LOG)
    # visualize the footprint table
    gviz = fp_visualizer.apply(fp_log_entire,
                               fp_net,
                               parameters={"format": "svg"})
    fp_visualizer.view(gviz)
예제 #21
0
def discover_process_tree_inductive(log: Union[EventLog, pd.DataFrame], noise_threshold: float = 0.0) -> ProcessTree:
    """
    Discovers a process tree using the IM algorithm

    Parameters
    --------------
    log
        Event log
    noise_threshold
        Noise threshold (default: 0.0)

    Returns
    --------------
    process_tree
        Process tree object
    """
    if type(log) not in [pd.DataFrame, EventLog, EventStream]: raise Exception("the method can be applied only to a traditional event log!")

    from pm4py.algo.discovery.inductive import algorithm as inductive_miner
    parameters = get_properties(log)
    parameters[inductive_miner.Variants.IM_CLEAN.value.Parameters.NOISE_THRESHOLD] = noise_threshold
    return inductive_miner.apply_tree(log, variant=inductive_miner.Variants.IM_CLEAN, parameters=parameters)
예제 #22
0
                except:
                    if ENABLE_PETRI_EXPORTING_DEBUG:
                        exce = traceback.format_exc()
                        pnml_exporter.export_net(
                            heu_model,
                            heu_initial_marking,
                            os.path.join(pnmlFolder,
                                         logNamePrefix + "_heuristics.pnml"),
                            final_marking=heu_final_marking)
                        F = open(logNamePrefix + "_heuristics.txt", "w")
                        F.write(exce)
                        F.close()

            t1 = time.time()
            tree = inductive.apply_tree(log,
                                        parameters=parameters_discovery,
                                        variant=INDUCTIVE_MINER_VARIANT)
            # print(tree)

            inductive_model, inductive_im, inductive_fm = pt_converter.apply(
                tree, variant=pt_converter.Variants.TO_PETRI_NET)
            """inductive_model, inductive_im, inductive_fm = inductive.apply(log, parameters=parameters_discovery,
                                                                          variant=INDUCTIVE_MINER_VARIANT)"""
            if ENABLE_PETRI_EXPORTING:
                pnml_exporter.export_net(
                    inductive_model,
                    inductive_im,
                    os.path.join(pnmlFolder,
                                 logNamePrefix + "_inductive.pnml"),
                    final_marking=inductive_fm)
            """
예제 #23
0
def apply(df0, classifier_function=None, parameters=None):
    if parameters is None:
        parameters = {}

    if classifier_function is None:
        classifier_function = lambda x: x["event_activity"]

    min_acti_freq = parameters[
        "min_acti_freq"] if "min_acti_freq" in parameters else 0
    min_edge_freq = parameters[
        "min_edge_freq"] if "min_edge_freq" in parameters else 0

    df = df0.copy()
    df = general.preprocess(df, parameters=parameters)

    df = clean_frequency.apply(df, min_acti_freq=min_acti_freq)
    df = clean_arc_frequency.apply(df, min_freq=min_edge_freq)

    models = {}

    obj_types = [x for x in df.columns if not x.startswith("event_")]
    activities = set()
    activities_repeated = Counter()
    edges = Counter()
    start_activities = dict()
    end_activities = dict()
    acti_spec = Counter()

    for ot in obj_types:
        start_activities[ot] = set()
        end_activities[ot] = set()

        new_df = df[["event_id", "event_activity", "event_timestamp",
                     ot]].dropna(subset=[ot])
        new_df = new_df.sort_values("event_timestamp")
        new_df = new_df.rename(columns={
            ot: "case:concept:name",
            "event_timestamp": "time:timestamp"
        })
        log = new_df.to_dict("r")
        for ev in log:
            ev["event_objtype"] = ot
            ev["concept:name"] = classifier_function(ev)
            del ev["event_objtype"]
            del ev["event_activity"]
            activities.add((ev["event_id"], ev["concept:name"]))

        log = EventStream(log)
        this_activities = set(x["concept:name"] for x in log)
        for act in this_activities:
            activities_repeated[act] += 1
        log = log_conv_factory.apply(log,
                                     variant=log_conv_factory.TO_EVENT_LOG)
        log = sorting.sort_timestamp(log, "time:timestamp")

        for trace in log:
            if trace:
                start_activities[ot].add(trace[0]["concept:name"])
                end_activities[ot].add(trace[-1]["concept:name"])
                for i in range(len(trace) - 1):
                    ev0 = trace[i]
                    ev1 = trace[i + 1]
                    edges[(ot, ev0["concept:name"], ev1["concept:name"],
                           ev0["event_id"], ev1["event_id"],
                           trace.attributes["concept:name"],
                           ev0["time:timestamp"], ev1["time:timestamp"])] += 1
                    acti_spec[(ot, trace[i]["concept:name"],
                               trace[i]["event_id"],
                               trace.attributes["concept:name"],
                               trace[i]["time:timestamp"])] += 1
                if len(trace) > 0:
                    acti_spec[(ot, trace[-1]["concept:name"],
                               trace[-1]["event_id"],
                               trace.attributes["concept:name"],
                               trace[-1]["time:timestamp"])] += 1

        models[ot] = inductive_miner.apply_tree(log, parameters=parameters)

    activities = dict(Counter(list(x[1] for x in activities)))
    activities_repeated = set(x for x in activities_repeated
                              if activities_repeated[x] > 1)

    return {
        "type": "ptree",
        "models": models,
        "activities": activities,
        "activities_repeated": activities_repeated,
        "edges": edges,
        "acti_spec": acti_spec
    }
예제 #24
0
def inductive_miner_tree(log):
    # create the process tree
    tree = inductive_miner.apply_tree(log)
    gviz = pt_visualizer.apply(tree)
    return gviz, None
예제 #25
0
                    for ele2 in sample:
                        chooselist.append(
                            (ele2[0], pre + (ele2[1] / dominator)))
                        pre += (ele2[1] / dominator)

                    r = random.random()

                    for i in range(len(chooselist) - 1):
                        if chooselist[i][1] <= r and chooselist[i + 1][1] >= r:
                            simrestrace.append(chooselist[i + 1][0])
                            print(event[logname], chooselist[i + 1][0])
        simreslog.append(simrestrace)
    return simreslog


tree = inductive_miner.apply_tree(log)
list0 = []
notdoact(tree, list0)
actrescount = getactivityresourcecount(log, list0, "concept:name", "org:group")
#print(actrescount,"actrescount")
roles = roles_discovery.apply(
    log, variant=None, parameters={rpd.Parameters.RESOURCE_KEY: "org:group"})
#rescluster = getresoucecluster(log,roles,"concept:name","org:resource")
print(roles, "roles")
resourcesimulation = simulateresource(log, actrescount, roles, "concept:name",
                                      "org:group")
print(resourcesimulation, "resourcesimulation")
#join activity but nothing different to the last segment.
#ja_values = sna.apply(log, variant=sna.Variants.JOINTACTIVITIES_LOG)
#gviz_ja_py = sna_visualizer.apply(ja_values, variant=sna_visualizer.Variants.PYVIS)
#sna_visualizer.view(gviz_ja_py, variant=sna_visualizer.Variants.PYVIS)
예제 #26
0
if True:
    # ignore this part in true PowerBI executions
    from pm4py.objects.log.adapters.pandas import csv_import_adapter

    dataset = csv_import_adapter.import_dataframe_from_path("C:/running-example.csv")

import pandas as pd

# this part is required because the dataframe provided by PowerBI has strings
dataset["time:timestamp"] = pd.to_datetime(dataset["time:timestamp"])

from pm4py.algo.discovery.inductive import algorithm as inductive_miner
tree = inductive_miner.apply_tree(dataset)

from pm4py.visualization.process_tree import visualizer
gviz = visualizer.apply(tree)
visualizer.matplotlib_view(gviz)
            t1 = time.time()
            heu_model, heu_initial_marking, heu_final_marking = heuristics_miner.apply(log,
                                                                                       parameters=parameters_discovery)
            if ENABLE_PETRI_EXPORTING:
                pnml_exporter.export_net(heu_model, heu_initial_marking,
                                         os.path.join(pnmlFolder, logNamePrefix + "_alpha.pnml"),
                                         final_marking=heu_final_marking)
            t2 = time.time()
            print("time interlapsed for calculating Heuristics Model", (t2 - t1))
            if CHECK_SOUNDNESS:
                print("heuristics is_sound_wfnet",
                      check_soundness.check_petri_wfnet_and_soundness(heu_model, debug=True))

            t1 = time.time()
            tree = inductive.apply_tree(log, parameters=parameters_discovery)
            print(tree)
            inductive_model, inductive_im, inductive_fm = inductive.apply(log, parameters=parameters_discovery)
            if ENABLE_PETRI_EXPORTING:
                pnml_exporter.export_net(inductive_model, inductive_im,
                                         os.path.join(pnmlFolder, logNamePrefix + "_inductive.pnml"),
                                         final_marking=inductive_fm)
            """
            generated_log = pt_semantics.generate_log(tree)
            print("first trace of log", [x["concept:name"] for x in generated_log[0]])
            """
            t2 = time.time()
            print("time interlapsed for calculating Inductive Model", (t2 - t1))
            if CHECK_SOUNDNESS:
                print("inductive is_sound_wfnet",
                      check_soundness.check_petri_wfnet_and_soundness(inductive_model, debug=True))
예제 #28
0
def execute_script():
    log = xes_importer.apply(
        os.path.join("..", "tests", "input_data", "receipt.xes"))
    throughput_time = case_statistics.get_median_caseduration(log)
    variants, variants_times = variants_filter.get_variants_along_with_case_durations(
        log)
    dfg = dfg_discovery.apply(log)
    filtered_log = variants_filter.apply_auto_filter(deepcopy(log))
    # filtered_log = log
    tree = inductive_miner.apply_tree(filtered_log)
    fp_log = fp_discovery.apply(log,
                                variant=fp_discovery.Variants.ENTIRE_EVENT_LOG)
    fp_model = fp_discovery.apply(tree)
    conf = fp_conformance.apply(fp_log, fp_model)
    conf_occ = sorted([(x, dfg[x]) for x in conf],
                      key=lambda y: (y[1], y[0][0], y[0][1]),
                      reverse=True)
    print(
        "source activity\t\ttarget activity\t\toccurrences\t\tthroughput time log\t\tthroughput time traces with path"
    )
    for i in range(min(10, len(conf_occ))):
        path = conf_occ[i][0]
        occ = conf_occ[i][1]
        red_log = paths_filter.apply(log, [path])
        red_throughput_time = case_statistics.get_median_caseduration(red_log)
        print("%s\t\t%s\t\t%d\t\t%s\t\t%s" %
              (path[0], path[1], occ, human_readable_stat(throughput_time),
               human_readable_stat(red_throughput_time)))
    variants_length = sorted([(x, len(variants[x])) for x in variants.keys()],
                             key=lambda y: (y[1], y[0]),
                             reverse=True)
    print(
        "\nvariant\t\toccurrences\t\tthroughput time log\t\tthroughput time traces with path"
    )
    for i in range(min(10, len(variants_length))):
        var = variants_length[i][0]
        vark = str(var)
        if len(vark) > 10:
            vark = vark[:10]
        occ = variants_length[i][1]
        fp_log_var = fp_discovery.apply(
            variants[var], variant=fp_discovery.Variants.ENTIRE_EVENT_LOG)
        conf_var = fp_conformance.apply(fp_log_var, fp_model)
        is_fit = str(len(conf_var) == 0)
        var_throughput = case_statistics.get_median_caseduration(variants[var])
        print("%s\t\t%d\t\t%s\t\t%s\t\t%s" %
              (vark, occ, is_fit, throughput_time,
               human_readable_stat(var_throughput)))

    # print(conf_occ)
    conf_colors = tree_visualization.apply(tree, conf)
    if True:
        gviz = pt_visualizer.apply(
            tree,
            parameters={
                "format":
                "svg",
                pt_visualizer.Variants.WO_DECORATION.value.Parameters.COLOR_MAP:
                conf_colors,
                pt_visualizer.Variants.WO_DECORATION.value.Parameters.ENABLE_DEEPCOPY:
                False
            })
        pt_visualizer.view(gviz)
예제 #29
0
from pm4py.objects.process_tree import semantics
import pm4py
from pm4py.objects.log.importer.xes import importer
from pm4py.simulation.tree_playout.variants import extensive
#log = pm4py.read_xes("BPI_Challenge_2012_APP.xes")
from pm4py.simulation.tree_playout import algorithm as tree_playout
playout_variant = tree_playout.Variants.EXTENSIVE
param = tree_playout.Variants.EXTENSIVE.value.Parameters

#treelist = "+( ->( 'B', 'C', 'D', 'E' ), 'A', 'G' )"
#treelist1 = treelist.split(" ")
#log0 = importer.apply('/Users/jiao.shuai.1998.12.01outlook.com/code/07.01.2021/DES1/testfile/test.xes')
log0 = importer.apply(
    '/Users/jiao.shuai.1998.12.01outlook.com/code/07.01.2021/DES1/testfile/test.xes'
)
tree = inductive_miner.apply_tree(log0)
#tree = infra.recieve_and_convert_log.convertptree(treelist1,None,0)
#tree = pm4py.discover_process_tree_inductive(log)
sim_log = extensive.apply(tree, parameters={param.MAX_LIMIT_NUM_TRACES: 100})
print('The generated traces are shown as follow:')
for trace in sim_log:
    print(trace, '~~~~~~~~~')

tree1 = inductive_miner.apply_tree(sim_log)
print('The previous tree:', tree, '\n', "The new tree:", tree1)
#sim_variants = pm4py.get_variants(sim_log)
'''
log0 = xes_importer.apply('/Users/jiao.shuai.1998.12.01outlook.com/code/07.01.2021/DES1/testfile/test.xes')
log1 = xes_importer.apply('/Users/jiao.shuai.1998.12.01outlook.com/code/07.01.2021/DES1/testfile/evalunew.xes')
log2 = xes_importer.apply('/Users/jiao.shuai.1998.12.01outlook.com/code/07.01.2021/DES1/testfile/evaluold.xes')