Predictive Business Process Monitoring with LSTM Neural Networks

Supplementary material for the paper presented in CAiSE '17

Following is the supplementary material for the article “Predictive Business Process Monitoring with LSTM Neural Networks” by Niek Tax, Ilya Verenich, Marcello La Rosa and Marlon Dumas presented at the 29th International Conference on Advanced Information Systems Engineering

The code provided in this repository can be readily used to perform the following predictive tasks:

The scripts trains a Long Short Term Memory (LSTM)-based predictive model using the data about historical, i.e. completed process instances. Next, the models are evaluated on running, i.e. incomplete instances.

Requirements:
Python 2. Additionally, the following Python libraries are required to run the code: keras (as a backend, you need either theano or tensorflow), unicodecsv, numpy, jellyfish, sklearn, matplotlib, h5py.
Note you might need the latest version of keras to run the code. Install it as:
pip install git+git://github.com/fchollet/keras.git

USAGE:
Data format
The tool assumes the input is a complete log of all traces in the CSV format wherein the first column is a case ID, then activity name or ID and finally the activity timestamp. Then, this input log is temporally split on 66% (training set) vs 34% (test set), and on the test set the tool evaluates prediction performance for every size of a partial trace, e.g a test trace cut at the 2nd event, the same trace cut at the 3rd event and so on, along all four prediction tasks. We provide sample datasets, including those used in the paper, in the data folder.

Model training:
python train.py
This script trains a two-layer LSTM model with one shared layer on one of the data files in the data folder of this repository (by default, on the helpdesk event log). To change the input file to another one from the data folder, indicate its name in line 46. It is recommended to run this script on GPU, as recurrent networks are quite computationally intensive.

Evaluation:
python evaluate_next_activity_and_time.py
This script takes as input the LSTM or RNN weights found by train.py and predicts the next event and its relative timestep for a partial trace. Change the path in line 176 of this script to point to the h5 file with LSTM or RNN weights generated by train.py. As an example, we provide the file model_89-1.50.h5 with one of the trained models

python evaluate_suffix_and_remaining_time.py
This script predicts the continuation of a partial trace, i.e. its suffix, until its completion.

python calculate_accuracy_on_next_event.py. This script evaluates the performance of the next event prediction (not the whole suffix). It takes the output of evaluate_suffix_and_remaining_time.py as input, therefore, the latter needs to be executed first

Known issues:

Reference: If you use the code from this repository, please cite the original paper:

@inproceedings{Tax2017,
  title={Predictive business process monitoring with {LSTM} neural networks},
  author={Tax, Niek and Verenich, Ilya and La Rosa, Marcello and Dumas, Marlon},
  booktitle={Proceedings of the 29th International Conference on Advanced Information Systems Engineering (CAiSE)},
  year={2017},
  pages={477--492},
  publisher={Springer}
}