This repository contains all the scripts required to reproduce the experiments from the paper: "Fire Now, Fire Later: Alarm-Based Systems for Prescriptive Process Monitoring" by Stephan A. Fahrenkrog-Petersen, Niek Tax, Irene Teinemaa, Marlon,Dumas, Massimiliano de Leoni, Fabrizio Maria Maggi, and Matthias Weidlich.
The code is written in Python 3.
A lot of the code in this repository was based on code from Irene Teinemaa and Niek Tax, available here: https://github.com/TaXxER/AlarmBasedProcessPrediction
The foundations of a prescriptive process monitoring systems are the predictions made by a predictive process monitoring systems. To get these results, we apply a two-step approach. First, we use hyperparameter optimization to ensure high quality results, this can be done with different scripts, depending on the choosen machine learning algorithm:
python optimize_params_<classifier>.py <dataset_name> <output_dir>
For the parameters the following applies:
- dataset_name - the name of the dataset, should correspond to the settings specified in dataset_confs.py
- output_dir - the name of the directory where the optimal parameters will be written
In a next step the results of the predictive process monitoring scripts are generated:
python write_<classifier>_predictions.py <dataset_name> <optimal_params_file> <output_dir>
- dataset_name - the name of the dataset, should correspond to the settings specified in dataset_confs.py
- optimal_params_file - the file where the optimized hyperparameter values can be found (from last step)
- output_dir - the name of the directory where the final predictions will be written
With the results of the predictive process monitoring script, we can try several prescriptive process monitoring systems. This is also split up into two steps. One step training the mechanism and another step generating the results from the mechnaism.
The following scripts implement systems with one potential alarm:
- optimize_threshold.py - Is the basic thresholding system, with one threshold for the probability. This scriptes is the script to train the system, with test_optimized_threshold.py being the corresponding script to generate the results
- optimize_fire_delay.py - Is the thresholding system using a probability threshold and a fire delay threshold. This scriptes is the script to train the system, with test_fire_delay.py being the corresponding script to generate the results
- optimize_2_thresholds_prefix.py - Is the thresholding system with 2 thresholds depending on the prefix. The prefix that inflicts the change between both thresholds is trained. The corresponding script to run the system is test_2_threholds_prefix.py
- optimize_2_thresholds_prefix_set_second_prefix.py - Sets 2 different threshold of the 2 first prefixes. The last threshold is valid for all following prefixes. test_2_thresholds_set_prefixes.py generates the respective results
- optimize_3_thresholds_prefix.py - Sets 2 different threshold of the 3 first prefixes. The last threshold is valid for all following prefixes. test_3_thresholds_prefix.py generates the respective results
- optimize_fire_delay_prefix_length_dependent_threshold.py - Combines the ideas behind the systems "optimize_fire_delay.py" and "optimize_2_thresholds_prefix.py". It trains 2 thresholds, that depend on the prefix length, and a fire delay parameter. The script test_fire_delay_prefix_length_dependent_threshold.py is the corresponding script to generate the results
The scripts optimize_threshold_compensation.py and optimize_threshold_effectiveness.py are scripts for experimental purposes and based on optimize_threshold.py.
To handle multiple potential alarms, we implemented the following systems:
- Basic Hierarchical Thresholding
- Hierarchical Thresholding with fire delay and multiple prefix-dependent thresholds
To execute these systems it is important to first run a training set for each of the thresholding systems with one alarm independently, these are implemented in the following scripts for the basic hierarchical thresholding systems:
- optimize_alarm1_threshold_compensation.py
- optimize_alarm2_threshold_compensation.py
Afterwards the script "optimize_alarm2_vs_alarm1_hierachical.py" is executed to finialize the training of the basic hierarchical thresholding system.
Some scripte in this repository were used to manage the generated by the experiments in the project. These include:
- rewrite_method.py - Can be used to change the name of the prescriptive process monitoring "mechanism" used to generate a certain result file
The R-scripts in this repository were used to generate the respective figures in the paper. They used the results generated by the approach implemented within the Python scripts.