Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,436 changes: 2,436 additions & 0 deletions Tests.ipynb

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions commands.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
cd C:\DanielBaron\GenerativeLSTM
conda activate deep_generator
python dg_prediction.py
69 changes: 0 additions & 69 deletions dg_predictiction.py

This file was deleted.

166 changes: 166 additions & 0 deletions dg_prediction.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 23 19:08:25 2021

@author: Manuel Camargo
"""
import os
import subprocess

os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import sys
import getopt
import shutil

from model_prediction import model_predictor as pr
import support_functions as sf
from support_modules import stochastic_model as sm
from support_modules import models_merger as mm

# =============================================================================
# Main function
# =============================================================================
def catch_parameter(opt):
"""Change the captured parameters names"""
switch = {'-h': 'help', '-a': 'activity', '-c': 'folder',
'-b': 'model_file', '-v': 'variant', '-r': 'rep'}
return switch.get(opt)

def call_simod(file_name):
print('----------------------------------------------------------------------')
print('------------------- RUNNING SIMOD -----------------------------')
print('----------------------------------------------------------------------')

simod_files = os.listdir(os.path.join('input_files', 'simod'))

#Copy event log file to Simod
source_file = os.path.join('input_files', file_name)
destination_file = os.path.join('..', 'Simod-2.3.1','inputs', file_name)
shutil.copy(source_file, destination_file)

if file_name not in simod_files:

os.chdir('../Simod-2.3.1/')
bash_command = 'bash.sh'
subprocess.run([bash_command, file_name], shell=True)
os.chdir('../GenerativeLSTM/')

#Delete event log file from Simod
os.remove(destination_file)

def call_spmd(parameters):
print('----------------------------------------------------------------------')
print('-------------- RUNNING Stochastic Process Model --------------------')
print('----------------------------------------------------------------------')
settings = dict()
settings['timeformat'] = parameters['read_options']['timeformat']
settings['column_names'] = parameters['read_options']['column_names']
settings['one_timestamp'] = parameters['read_options']['one_timestamp']
settings['filter_d_attrib'] = parameters['read_options']['filter_d_attrib']

settings['file'] = parameters['filename'].split('.')[0]
settings['sm3_path'] = parameters['sm3_path']

settings['bimp_path'] = parameters['bimp_path']
settings['concurrency'] = parameters['concurrency']
settings['epsilon'] = parameters['epsilon']
settings['eta'] = parameters['eta']

settings['log_path'] = os.path.join('input_files', settings['file'] + '.xes')
settings['tobe_bpmn_path'] = os.path.join('input_files', 'spmd', settings['file'] + '.bpmn')

spmd = sm.StochasticModel(settings)
return spmd

def call_merger(parameters, spmd):
print('----------------------------------------------------------------------')
print('--------------------------- RUNNING MERGER --------------------------')
print('----------------------------------------------------------------------')
settings = dict()
settings['file'] = parameters['filename'].split('.')[0]
settings['bimp_path'] = parameters['bimp_path']
settings['tobe_bpmn_path'] = os.path.join('input_files', 'spmd', settings['file'] + '.bpmn')
settings['asis_bpmn_path'] = os.path.join('input_files', 'simod', settings['file'] + '.bpmn')
settings['csv_output_path'] = os.path.join('output_files', 'simulation_stats', settings['file'] + '.csv')
settings['output_path'] = os.path.join('output_files', 'simulation_files', settings['file'] + '.bpmn')
settings['lrs'] = spmd.lrs

mod_mer = mm.MergeModels(settings)

def main(argv):
parameters = dict()
column_names = {'Case ID': 'caseid',
'Activity': 'task',
'lifecycle:transition': 'event_type',
'Resource': 'user'}
parameters['one_timestamp'] = False # Only one timestamp in the log
parameters['include_org_log'] = False
parameters['read_options'] = {

#Production and Purchasing: "%Y-%m-%d %H:%M:%S%z"
#RunningExample: "%Y-%m-%d %H:%M:%S%z"
#ConsultaDataMining201618: "%Y-%m-%d %H:%M:%S%z"

'timeformat': "%Y-%m-%d %H:%M:%S%z",
'column_names': column_names,
'one_timestamp': parameters['one_timestamp'],
'filter_d_attrib': False}

parameters['filename'] = 'Production.xes'
parameters['input_path'] = 'input_files'

parameters['sm3_path'] = os.path.join('external_tools', 'splitminer3', 'bpmtk.jar')
parameters['bimp_path'] = os.path.join('external_tools', 'bimp', 'qbp-simulator-engine_with_csv_statistics.jar')
parameters['concurrency'] = 0.0
parameters['epsilon'] = 0.5
parameters['eta'] = 0.7

# Parameters settled manually or catched by console for batch operations
if not argv:
# predict_next, pred_sfx
parameters['activity'] = 'pred_log'

#PurchasingExample:'20230615_13B0567C_E061_48DD_834E_459450B6076F'
#Production: '20230615_FF2C5479_8FD9_4E8A_9473_F298F8D2618D'
#RunningExample: '20230615_337FD5C6_4BEA_4D3C_A7B4_57E09596867E'
#ConsultaDataMining201618: '20230615_10C7EA49_AF7D_48B6_8039_E007B2F61885'

parameters['folder'] = '20230615_FF2C5479_8FD9_4E8A_9473_F298F8D2618D'
parameters['model_file'] = parameters['filename'].split('.')[0] + '.h5'
parameters['log_name'] = parameters['model_file'].split('.')[0]
parameters['is_single_exec'] = False # single or batch execution
# variants and repetitions to be tested Random Choice, Arg Max, Rules Based Random Choice, Rules Based Arg Max
parameters['variant'] = 'Rules Based Random Choice'
parameters['rep'] = 1
else:
# Catch parms by console
try:
opts, _ = getopt.getopt(argv, "ho:a:f:c:b:v:r:",
['one_timestamp=', 'activity=', 'folder=',
'model_file=', 'variant=', 'rep='])
for opt, arg in opts:
key = catch_parameter(opt)
if key in ['rep']:
parameters[key] = int(arg)
else:
parameters[key] = arg
except getopt.GetoptError:
print('Invalid option')
sys.exit(2)
print(parameters['folder'])
print(parameters['model_file'])

# Call Simod
call_simod(parameters['filename'])

#Generative model prediction
#pr.ModelPredictor(parameters)

#Call SPMD
#spmd = call_spmd(parameters)

#Call Merger
#call_merger(parameters, spmd)

if __name__ == "__main__":
main(sys.argv[1:])
8 changes: 5 additions & 3 deletions dg_training.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,18 @@ def main(argv):
'Resource': 'user'}
parameters['one_timestamp'] = False # Only one timestamp in the log
parameters['read_options'] = {
'timeformat': '%Y-%m-%dT%H:%M:%S.%f',
#RunningExample: "%Y-%m-%dT%H:%M:%S.%fZ"
#PurchasingExample y Production: '%Y/%m/%d %H:%M:%S'
'timeformat': '%Y/%m/%d %H:%M:%S',
'column_names': column_names,
'one_timestamp': parameters['one_timestamp']}
# Parameters settled manually or catched by console for batch operations
if not argv:
# Event-log filename
parameters['file_name'] = 'Production.csv'
parameters['file_name'] = 'ConsultaDataMining201618.xes'
parameters['model_family'] = 'lstm'
parameters['opt_method'] = 'bayesian' # 'rand_hpc', 'bayesian'
parameters['max_eval'] = 1
parameters['max_eval'] = 10
else:
# Catch parms by console
try:
Expand Down
4 changes: 3 additions & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ dependencies:
- nltk
- scikit-learn
- ipywidgets
- networkx
- xmltodict
- pip:
- hyperopt
- jellyfish
- keras
- pm4py
- tensorflow
- opyenxes
- git+https://github.com/Mcamargo85/support_modules.git
- git+https://github.com/Mcamargo85/support_modules.git
Binary file added external_tools/bimp/qbp-simulator-engine.jar
Binary file not shown.
Binary file not shown.
Binary file added external_tools/calenderimp/CalenderImp.jar
Binary file not shown.
Binary file added external_tools/proconformance/ProConformance2.jar
Binary file not shown.
67 changes: 67 additions & 0 deletions external_tools/proconformance/readMe
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
------------------------
ProConformance v2.0
------------------------

REQUIREMENTS:
Java 8 or above

WHAT IT DOES:
ProConformance v2.0 is a business process conformance checking tool for identifying and verbalising differences between a process model and an event log in a scalable way.

HOW:
ProConformance v2.0 implements the conformance checking technique described in the paper
"Scalable Conformance Checking of Business Processes" by D. Reißner, R. Conforti, M. Dumas, M. La Rosa
and A. Armas-Cervantes.

USAGE:
java -jar ProConformance2.jar [folder] [logfile] [modelfile] [doOneOptimal] [stateLimit] [materlialiseDataStructures]

Input : A process model in bpmn or pnml format and an event log in either mxml or xes format.
Output: The difference between the model and the event log in terms of control-flow.

PARAMETERS:

[folder] : Folder where all input files are located and where the output files will be created.
[logFile] : Event log including extension (either .mxml or .xes).
[modelFile] : Process model including extension (.pnml or bpmn).
[doOneOptimal] : (optional) type “true” for applying the one optimal alignment variant.
[stateLimit] : (optional) specify a state limit for the algorithm, i.e. “10000”.
[materialiseDataStructures] : (optional) type “true” for materialising the underlying DAFSA, tales reachability graph and PSP Data structures.

Parameters [folder], [logfile] and [modelfile] are compulsory.
Parameters [doOneOptimal], [stateLimit] and [materialiseDataStructures] are optional, but expected in this order.
If the algorithm should materialise data structures for the all optimal variant with no state limit, it can be specified by adding: “” “no” “true”.

Using the tool without any parameters will provide release information of the tool.

OUTPUT:
The tool will create three output files in the specified [folder] with the following names and contents:
AlignmentStatistics.csv : Statistics of the alignment process for each case present in the event log. Averages are also reported.
CaseTypeAlignmentResults.csv : Alignment Results for each case type. Can be cross referenced with file AlignmentStatistics.csv to obtain all optimal alignments for each case.
BehavioralStatements.txt: List of natural language statements about higher level behavioural issues between the event log and the process model.

In Case the parameter [materialiseDataStructures] is set to “true”, the tool will in addition output three files representing the applied data structures:
[logfile]_dafsa.dot : DAFSA representation of the event log in the .dot format.
[modelfile]_taulessRG.dot : Tauless reachability graph representation of the specified process model in the .dot format.
[psp.dot] : The synchronised product automaton between the DAFSA and the tales reachability graph in the .dot format.

The .dot format (https://en.wikipedia.org/wiki/DOT_(graph_description_language)) represents graph structures.
Files in this format can be opened with the application graphviz (http:http://www.graphviz.org) for example.

ASSUMPTIONS:
The input model should be formatted according to the pnml (http://www.pnml.org/) format.
To check that the input model is correctly formatted, you can open the model using WoPeD.

The tool accepts models formatted according to the bpmn (http://http://www.bpmn.org) format.
The tool will internally convert the bpmn diagram to its equivalent Petri net representation.

The input log should be formatted according to the mxml or xes (OpenXES, http://www.xes-standard.org/) format.
To check that the input log is correctly formatted, you can open the log using the ProM toolkit.

If the parameter [doOneOptimal] is anything else than “true”, the tool applies the all optimal variant.
The parameter [stateLimit] expects an integer value or the value “no”, if no state limit should be specified.
If the parameter [materialiseDataStructures] is anything else than “true”, the tool will not output the data structures.

RELEASE NOTES:

1.0: initial version
Binary file added external_tools/splitminer/splitminer.jar
Binary file not shown.
Binary file not shown.
Binary file added external_tools/splitminer2/lib/ApacheUtils.jar
Binary file not shown.
Binary file added external_tools/splitminer2/lib/BPMN.jar
Binary file not shown.
Binary file added external_tools/splitminer2/lib/BasicUtils.jar
Binary file not shown.
Binary file added external_tools/splitminer2/lib/CNet.jar
Binary file not shown.
Binary file added external_tools/splitminer2/lib/ETConformance.jar
Binary file not shown.
Binary file added external_tools/splitminer2/lib/GraphViz.jar
Binary file not shown.
Binary file added external_tools/splitminer2/lib/InductiveMiner.jar
Binary file not shown.
Binary file not shown.
Binary file added external_tools/splitminer2/lib/Log.jar
Binary file not shown.
Binary file not shown.
Binary file added external_tools/splitminer2/lib/LogToDAFSA.jar
Binary file not shown.
Binary file added external_tools/splitminer2/lib/Murata.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added external_tools/splitminer2/lib/PNAnalysis.jar
Binary file not shown.
Binary file added external_tools/splitminer2/lib/PNetReplayer.jar
Binary file not shown.
Binary file added external_tools/splitminer2/lib/PetriNets.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added external_tools/splitminer2/lib/ProM-Plugins.jar
Binary file not shown.
Binary file added external_tools/splitminer2/lib/ProcessTree.jar
Binary file not shown.
Binary file not shown.
Binary file added external_tools/splitminer2/lib/Properties.jar
Binary file not shown.
Binary file added external_tools/splitminer2/lib/Sat4j.jar
Binary file not shown.
Binary file not shown.
Binary file added external_tools/splitminer2/lib/Widgets.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added external_tools/splitminer2/lib/guava-20.0.jar
Binary file not shown.
Binary file added external_tools/splitminer2/lib/javacsv-2.1.jar
Binary file not shown.
Binary file added external_tools/splitminer2/lib/javailp-1.2a.jar
Binary file not shown.
Binary file added external_tools/splitminer2/lib/jbpt-0.2.429.jar
Binary file not shown.
Binary file added external_tools/splitminer2/lib/jdom-2.0.6.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added external_tools/splitminer2/lib/jgraph.jar
Binary file not shown.
Binary file not shown.
Binary file added external_tools/splitminer2/lib/jmathplot.jar
Binary file not shown.
Binary file added external_tools/splitminer2/lib/json-20090211.jar
Binary file not shown.
Binary file added external_tools/splitminer2/lib/kxml2-2.2.3.jar
Binary file not shown.
Binary file added external_tools/splitminer2/lib/kxml2-2.3.0.jar
Binary file not shown.
Binary file not shown.
Binary file added external_tools/splitminer2/lib/lpsolve55j.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added external_tools/splitminer2/lib/tablelayout.jar
Binary file not shown.
Binary file added external_tools/splitminer2/lib/trove-3.1a1.jar
Binary file not shown.
Binary file added external_tools/splitminer2/lib/uitopia-6.5.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added external_tools/splitminer2/lib/weka.jar
Binary file not shown.
Binary file added external_tools/splitminer2/sm2.jar
Binary file not shown.
Binary file added external_tools/splitminer3/bpmtk.jar
Binary file not shown.
Binary file not shown.
Binary file added external_tools/splitminer3/lib/ApacheUtils.jar
Binary file not shown.
Binary file added external_tools/splitminer3/lib/BPMN.jar
Binary file not shown.
Binary file added external_tools/splitminer3/lib/BasicUtils.jar
Binary file not shown.
Binary file added external_tools/splitminer3/lib/CNet.jar
Binary file not shown.
Binary file added external_tools/splitminer3/lib/ETConformance.jar
Binary file not shown.
Binary file added external_tools/splitminer3/lib/GraphViz.jar
Binary file not shown.
Binary file added external_tools/splitminer3/lib/InductiveMiner.jar
Binary file not shown.
Binary file not shown.
Binary file added external_tools/splitminer3/lib/Log.jar
Binary file not shown.
Binary file not shown.
Binary file added external_tools/splitminer3/lib/LogToDAFSA.jar
Binary file not shown.
Binary file added external_tools/splitminer3/lib/Murata.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added external_tools/splitminer3/lib/PNAnalysis.jar
Binary file not shown.
Binary file added external_tools/splitminer3/lib/PNetReplayer.jar
Binary file not shown.
Binary file added external_tools/splitminer3/lib/PetriNets.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added external_tools/splitminer3/lib/ProM-Plugins.jar
Binary file not shown.
Binary file added external_tools/splitminer3/lib/ProcessTree.jar
Binary file not shown.
Binary file not shown.
Binary file added external_tools/splitminer3/lib/Properties.jar
Binary file not shown.
Binary file added external_tools/splitminer3/lib/Sat4j.jar
Binary file not shown.
Binary file not shown.
Binary file added external_tools/splitminer3/lib/Widgets.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added external_tools/splitminer3/lib/guava-20.0.jar
Binary file not shown.
Binary file added external_tools/splitminer3/lib/javacsv-2.1.jar
Binary file not shown.
Binary file added external_tools/splitminer3/lib/javailp-1.2a.jar
Binary file not shown.
Binary file added external_tools/splitminer3/lib/jbpt-0.2.429.jar
Binary file not shown.
Binary file added external_tools/splitminer3/lib/jdom-2.0.6.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added external_tools/splitminer3/lib/jgraph.jar
Binary file not shown.
Binary file not shown.
Binary file added external_tools/splitminer3/lib/jmathplot.jar
Binary file not shown.
Binary file added external_tools/splitminer3/lib/json-20090211.jar
Binary file not shown.
Binary file added external_tools/splitminer3/lib/kxml2-2.2.3.jar
Binary file not shown.
Binary file added external_tools/splitminer3/lib/kxml2-2.3.0.jar
Binary file not shown.
Binary file not shown.
Binary file added external_tools/splitminer3/lib/lpsolve55j.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added external_tools/splitminer3/lib/tablelayout.jar
Binary file not shown.
Binary file added external_tools/splitminer3/lib/trove-3.1a1.jar
Binary file not shown.
Binary file added external_tools/splitminer3/lib/uitopia-6.5.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added external_tools/splitminer3/lib/weka.jar
Binary file not shown.
Loading