示例#1
0
 def test_log_skeleton(self):
     log = xes_importer.apply(
         os.path.join("input_data", "running-example.xes"))
     from pm4py.algo.discovery.log_skeleton import algorithm as lsk_discovery
     model = lsk_discovery.apply(log)
     from pm4py.algo.conformance.log_skeleton import algorithm as lsk_conformance
     conf = lsk_conformance.apply(log, model)
示例#2
0
def execute_script():
    # loads a XES event log
    event_log = pm4py.read_xes("../tests/input_data/receipt.xes")
    # gets the dataframe out of the event log (through conversion)
    dataframe = pm4py.convert_to_dataframe(event_log)
    # discovers the log skeleton model
    log_skeleton = log_skeleton_discovery.apply(
        event_log,
        parameters={
            log_skeleton_discovery.Variants.CLASSIC.value.Parameters.NOISE_THRESHOLD:
            0.03
        })
    # apply conformance checking
    conf_result = log_skeleton_conformance.apply(event_log, log_skeleton)
    # gets the diagnostic result out of the dataframe
    diagnostics = log_skeleton_conformance.get_diagnostics_dataframe(
        event_log, conf_result)
    # merges the dataframe containing the events, and the diagnostics dataframe, using the pd.merge method
    merged_df = pd.merge(dataframe,
                         diagnostics,
                         how="left",
                         left_on="case:concept:name",
                         right_on="case_id",
                         suffixes=('', '_diagn'))
    print(merged_df)
 def test_log_skeleton(self):
     log = pm4py.read_xes("input_data/running-example.xes")
     log_skeleton = log_skeleton_discovery.apply(
         log,
         parameters={
             log_skeleton_discovery.Variants.CLASSIC.value.Parameters.NOISE_THRESHOLD:
             0.05
         })
     conf_result = log_skeleton_conformance.apply(log, log_skeleton)
     diagn_df = log_skeleton_conformance.get_diagnostics_dataframe(
         log, conf_result)
示例#4
0
def execute_script():
    log = xes_importer.apply(
        os.path.join("..", "tests", "input_data", "receipt.xes"))
    # discovers the log skeleton with a minimal noise
    log_skeleton = lsk.apply(
        log,
        parameters={
            lsk.Variants.CLASSIC.value.Parameters.NOISE_THRESHOLD: 0.01
        })
    print(log_skeleton)
    # applies conformance checking to it
    results = lsk_conf.apply(log, log_skeleton)
    for i in range(min(len(results), 5)):
        # print the i-the conformance checking
        print(results[i])
示例#5
0
 def test_log_skeleton(self):
     log = xes_importer.apply(os.path.join("input_data", "receipt.xes"))
     skeleton = lsk_alg.apply(log)
     conf_res = lsk_conf_alg.apply(log, skeleton)
示例#6
0
        for r in self.working_relationships:
            r_instance = self.relationships[r](self.log,
                                               self.all_activities,
                                               self.noise_threshold,
                                               include_extenstions=extension)

            res[r] = r_instance.apply()
        res['activities'] = list(self.all_activities)
        return res


if __name__ == "__main__":
    importer = XES_Importer()

    path = os.path.join(os.path.dirname(__file__),
                        '../../../res/logs/running-example.xes')

    log_and_activset = importer.import_file(path, [], [])
    log = log_and_activset[0]
    activset = log_and_activset[1]

    skeleton = lsk_discovery.apply(
        log,
        parameters={
            lsk_discovery.Variants.CLASSIC.value.Parameters.NOISE_THRESHOLD: 0
        })
    print(skeleton)
    model = Log_Skeleton(log, activset, 0.1)
    model.set_working_relationships(['always_before', 'counter'])
    print(model.apply())