Process Mining Embeddings: Learning Vector Representations for Petri Nets
Summary
Embedding vectors serve as numerical representations within a continuous vector space, widely employed in machine learning tasks for capturing semantic relationships between entities. In the context of process mining, embeddings offer a robust approach to representing complex process structures and relationships within process models.
This repository is dedicated to introducing our proposed method, which aims to encode both the structural information of process models in Petri Net format and individual tasks into concise vector representations. Our approach draws inspiration from the strengths of both doc2vec and graph2vec techniques.
The significance of these embeddings lies in their ability to facilitate various downstream tasks, including similarity analysis and process classification. These capabilities enable sophisticated analyses that were previously challenging to achieve with traditional process representations. Join us as we explore the realm of process mining with the aid of embeddings.
Dependecies (recomended order):
-
sudo apt install libopenblas-dev -
pip install scipy==1.11.1 -
pip install gensim -
pip install pm4py -
pip install requests -
sudo apt-get install graphviz
Installation:
pip install PetriNet2Vec
How to use PetriNet2Vec
# Necessary imports
import os
import pm4py
from PetriNet2Vec import PetriNet2Vec
pm4py.util.constants.SHOW_PROGRESS_BAR = False
import warnings
warnings.filterwarnings('ignore')
import requests, zipfile, io
Download dataset for training
# The PDC 2023 folder contains the dataset used in the Process Discovery Contest of 2023.
# The dataset contains 96 models stored as .pnml files.
r = requests.get('https://data.4tu.nl/file/afd6f608-469e-48f9-977d-875b45840d39/e8eaeb15-b503-443c-8666-43f3c5261eb2')
z = zipfile.ZipFile(io.BytesIO(r.content))
z.extractall("Models")
Load the models with pm4py
models = sorted(os.listdir('./Models/'))
petriNets = []
petriNets_im = []
petriNets_fm = []
for model in models:
net, im, fm = pm4py.read_pnml(os.path.join('./Models/', model))
petriNets.append(net)
petriNets_im.append(im)
petriNets_fm.append(fm)
Vector Embedding Learning
pnml2vec = PetriNet2Vec(embedding_dim=8, # '8' minimum acceptable number of embedding dimensions
workers=8) # number of paraller works
pnml2vec.fit(petriNets, epochs=1000)
pnml2vec.save_model("trained_model")
Getting embedding vectors
embeddings_vectors = pnml2vec.get_net_embeddings()
# showing the fisrt Petri net and its embedding
print('Embeddings Vector:' ,embeddings_vectors[0])
print('\nPetri net model:')
pm4py.view_petri_net(petriNets[0], petriNets_im[0], petriNets_fm[0])
Metadata
Release files for PetriNet2Vec 1.0.3.post1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| PetriNet2Vec-1.0.3.post1-py3-none-any.whl | Python 3 | none | any | Details for PetriNet2Vec-1.0.3.post1-py3-none-any.whl |
Release files / PetriNet2Vec-1.0.3.post1-py3-none-any.whl
| Download URL | PetriNet2Vec-1.0.3.post1-py3-none-any.whl |
|---|---|
| Size | 8.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
500418384ba3a55cd11ebd6d28d425af7520f03080bbba5352512eb9cb47c80c
|
|
BLAKE2b-256 checksum How to use checksums |
4f2a59ab8c6963bc42d67f9e2de05a5334186da3ef65438f88c3810d0642f588
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.10.12
|
Security for PetriNet2Vec 1.0.3.post1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.