def execute_script():
    # log_path = "C:/Users/bas/Documents/tue/svn/private/logs/ilp_test_2_abcd_acbd.xes"
    log_path = os.path.join("..", "tests", "input_data", "running-example.xes")
    log = xes_importer.import_log(log_path)
    ts = ts_factory.apply(log)
    viz = ts_vis_factory.apply(ts, parameters={"format": "svg"})
    ts_vis_factory.view(viz)
예제 #2
0
 def test_transitionsystem1(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"
     input_log = os.path.join(INPUT_DATA_DIR, "running-example.xes")
     log = xes_importer.import_log(input_log)
     ts = ts_factory.apply(log, parameters={parameters.PARAM_KEY_VIEW: parameters.VIEW_SEQUENCE,
                                            parameters.PARAM_KEY_WINDOW: 3,
                                            parameters.PARAM_KEY_DIRECTION: parameters.DIRECTION_FORWARD})
     viz = pm4py.visualization.transition_system.util.visualize_graphviz.visualize(ts)
     del viz
예제 #3
0
def discover_annotated_automaton(tel, parameters=None):
    '''
    Discovers annotated automaton with thresholds

    Parameters
    -----------
    tel
        translucent event log
    parameters
        Possible parameters of the algorithm,
        afreq_thresh, atsum_thresh, atavg_thresh, sfreq_thresh, stsum_thresh, stavg_thresh

    Returns
    ---------
    ann_auto
        annotated automaton applying threshold

    '''

    if parameters is None:
        parameters = {}

    afreq_thresh = parameters[
        defaults.
        AFREQ_THRESH] if defaults.AFREQ_THRESH in parameters else defaults.DEFAULT_AFREQ_THRESH
    atsum_thresh = parameters[
        defaults.
        ATSUM_THRESH] if defaults.ATSUM_THRESH in parameters else defaults.DEFAULT_ATSUM_THRESH
    atavg_thresh = parameters[
        defaults.
        ATAVG_THRESH] if defaults.ATAVG_THRESH in parameters else defaults.DEFAULT_ATAVG_THRESH
    sfreq_thresh = parameters[
        defaults.
        SFREQ_THRESH] if defaults.SFREQ_THRESH in parameters else defaults.DEFAULT_SFREQ_THRESH
    stsum_thresh = parameters[
        defaults.
        STSUM_THRESH] if defaults.STSUM_THRESH in parameters else defaults.DEFAULT_STSUM_THRESH
    stavg_thresh = parameters[
        defaults.
        STAVG_THRESH] if defaults.STAVG_THRESH in parameters else defaults.DEFAULT_STAVG_THRESH

    if isinstance(tel[0][0], Event):
        auto = apply_annotated_automaton(tel)
        auto.filter(afreq_thresh=afreq_thresh,
                    atsum_thresh=atsum_thresh,
                    atavg_thresh=atavg_thresh,
                    sfreq_thresh=sfreq_thresh,
                    stsum_thresh=stsum_thresh,
                    stavg_thresh=stavg_thresh)
    else:
        auto = trans_factory.apply(tel, parameters)

    return auto
예제 #4
0
 def test_tsystem(self):
     log = xes_importer.apply(
         os.path.join("input_data", "running-example.xes"))
     from pm4py.algo.discovery.transition_system import factory as ts_system
     tsystem = ts_system.apply(log, variant=ts_system.VIEW_BASED)
예제 #5
0
from translucent_event_log.objects.tel.importer.xes.iterparse_tel import import_tel
import os
from translucent_event_log.objects.tel.importer.xes.utils import log_to_tel
from translucent_event_log.objects.tel.utils import tel_set_enabled
from pm4py.algo.discovery.alpha import factory as alpha_miner
from pm4py.visualization.petrinet import factory as vis_factory
from pm4py.visualization.transition_system import factory as trans_vis_factory
from pm4py.algo.discovery.transition_system import factory as trans_factory
from translucent_event_log.objects.tel import utils
from translucent_event_log.algo.discover_petrinet import state_based_region as sb

input_file_path = os.path.join("input_data", "test_logs", "running_10_tel.xes")
log = import_tel(input_file_path)
tel = tel_set_enabled(log)

auto = utils.discover_annotated_automaton(tel)
gviz = trans_vis_factory.apply(auto)
trans_vis_factory.view(gviz)  #show automaton

auto_2 = trans_factory.apply(log)

nett, im, fm = sb.petri_net_synthesis(auto)
net, i, f = sb.petri_net_synthesis(auto_2)
#
gviz = vis_factory.apply(nett, im, fm)
vis_factory.view(gviz)

# gviz = vis_factory.apply(net, i, f)
# vis_factory.view(gviz)
예제 #6
0
 def test_ts_df(self):
     log = csv_import_adapter.import_dataframe_from_path(
         os.path.join("input_data", "running-example.csv"))
     ts = ts_disc_factory.apply(log)
예제 #7
0
 def test_ts_stream(self):
     stream = csv_importer.apply(
         os.path.join("input_data", "running-example.csv"))
     ts = ts_disc_factory.apply(stream)
예제 #8
0
 def test_ts_log(self):
     log = xes_importer.apply(
         os.path.join("input_data", "running-example.xes"))
     ts = ts_disc_factory.apply(log)