Process Transformer Network for Predictive Business Process Monitoring Tasks
Project description
Process Transformer
Transformer Neural Model for Business Process Monitoring Tasks
Tasks
- Next Activity Prediction
- Time Prediction of Next Activity
- Remaining Time Prediction
Install
pip install processtransformer
Usage
import argparse
import tensorflow as tf
from processtransformer import constants
from processtransformer.data import loader
from processtransformer.models import transformer
parser = argparse.ArgumentParser(description="Process Transformer - Next Activity Prediction.")
parser.add_argument("--dataset", required=True, type=str, help="dataset name")
parser.add_argument("--task", type=constants.Task,
default=constants.Task.NEXT_ACTIVITY, help="task name")
parser.add_argument("--epochs", default=1, type=int, help="number of total epochs")
parser.add_argument("--batch_size", default=12, type=int, help="batch size")
parser.add_argument("--learning_rate", default=0.001, type=float,
help="learning rate")
# Load data
data_loader = loader.LogsDataLoader(name = args.dataset)
(train_df, test_df, x_word_dict, y_word_dict, max_case_length,
vocab_size, num_output) = data_loader.load_data(args.task)
# Prepare training examples for next activity prediction task
train_token_x, train_token_y = data_loader.prepare_data_next_activity(train_df,
x_word_dict, y_word_dict, max_case_length)
# Create and train a transformer model
transformer_model = transformer.get_next_activity_model(
max_case_length=max_case_length,
vocab_size=vocab_size,
output_dim=num_output)
transformer_model.compile(optimizer=tf.keras.optimizers.Adam(args.learning_rate),
loss=tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True),
metrics=[tf.keras.metrics.SparseCategoricalAccuracy()])
transformer_model.fit(train_token_x, train_token_y,
epochs=args.epochs, batch_size=args.batch_size)
See complete code examples within the github repository for other tasks, including preparing raw process data for transformer model.
Tools
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file processtransformer-0.1.3.tar.gz.
File metadata
- Download URL: processtransformer-0.1.3.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.5.0.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
514c0e48f5f87d152a05ac05e6c8bb84a22ad20ce1c22c0d4038a54a53b6a857
|
|
| MD5 |
1ec6e58cbf609107d928bc5393f0ed23
|
|
| BLAKE2b-256 |
dc08e223252ce4b5afc404ca2eb7c20de9d5d3384b26ba4818ee818758bf57c2
|
File details
Details for the file processtransformer-0.1.3-py3-none-any.whl.
File metadata
- Download URL: processtransformer-0.1.3-py3-none-any.whl
- Upload date:
- Size: 11.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.5.0.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4dd9b59abbe4ff08abcf0c7af989a3e16f91bae144094ed2178c1b43a0647ace
|
|
| MD5 |
0b75cbb989c342e863390b63b790fa22
|
|
| BLAKE2b-256 |
98abe39e8ad6b58bb32598c95d2400894e6e380653d02acbca402b1824b651ea
|