Package: declare4py
Declare4PyDeclare4Py is the first Python package for declarative Process Mining with core functionalities to
easily implement Machine Learning applications for Process Mining. Declarative process mining uses
declarative behavioural rules (based on Linear Temporal Logic on finite traces) for defining process models. This
results in a high flexibility of the business process model definition without neglecting hard
constraints that must be satisfied. Moreover, declarative languages can be used as a bridge between
Process Mining and Machine learning with the DECLARE encoding that encodes the traces in a log into a
numeric format suitable as input to Machine Learning algorithms. Declare4Py implements such a bridge
by including standard algorithms for:declarative Process Mining with LTLf or (MP)-DECLARE templates (e.g., conformance checking, model discovery, trace generation, query checking);log encodings (e.g., complex-index, aggregate, Declare);log labelling according to filtering or declarative rules.All the Declare4Py data formats are compatible with the main Machine Learning Python packages: scikit-learn, Tensorflow and PyTorch.InstallationWe recommend the use of a virtual environment to avoid possible clashes between your local Python version and the required
libraries. A virtual environment can be created withCondaor with thevenvPython utility. Once a virtual environment has been created,
download the Declare4Py project on your local machine, activate the created virtual environment and usepiporcondato install the required dependencies in therequirements.txtfile. As an alternative you can install Declare4py fromPyPi.In addition, theLydiabackend for the LTLf conformance checking need to be installed with Docker:InstallDocker;Download the Lydia Docker image withdocker pull whitemech/lydia:latest;Make the Docker image executable under the namelydia. On Linux and MacOS machines, the following commands should work:echo '#!/usr/bin/env sh' > lydia
echo 'docker run -v$(pwd):/home/default whitemech/lydia lydia "$@"' >> lydia
sudo chmod u+x lydia
sudo mv lydia /usr/local/bin/More information can be foundhere.TutorialsThedocs/source/tutorials/folder contains a walk-through of Declare4Py. In order, the tutorials cover the following topics:Managing event logs: methods to manage event logs, importing them, extracting useful information, converting them in other formats;Managing process models: simple methods to parse and manage process models from strings and/or files and checking their satisfiability;Conformance checking of LTLf templates/formulas: check what are the traces in an event log that satisfy a given LTLf model;Log filtering with LTLf properties: filter a log according to an LTLf model;Conformance checking of MP-DECLARE templates: check what are the traces in an event log (along with the fulfillments/violations) that satisfy a given MP_DECLARE model;Query Checking with DECLARE models: discover what are the activities that make an input DECLARE constraint satisfied in an event log;Discovery of DECLARE models: discover what are the most satisfied DECLARE constraints in an event log;Filtering an event log: select a subset of an event log that satisfy some input properties;Log generation with a MP-DECLARE model: generate synthetic cases that satisfy an MP-DECLARE model.The tutorials are Jupyter notebooks and consider theSepsis cases log.Repository Structuresrc/declare4py/ProcessModels-- the implementation of the supported process models.src/declare4py/ProcessMiningTasks/-- the implementation of the supported Process Mining tasks.tests/-- a collection of tests for computing the Declare4Py performance.docs/source/tutorials/-- tutorials to start with Declare4Py,Citing Declare4PyIf you use Declare4Py in your research, please use the following BibTeX entry.@inproceedings{DonadelloRMS22,
  author    = {Ivan Donadello and
               Francesco Riva and
               Fabrizio Maria Maggi and
               Aladdin Shikhizada},
  title     = {Declare4Py: {A} Python Library for Declarative Process Mining},
  booktitle = {{BPM} (PhD/Demos)},
  series    = {{CEUR} Workshop Proceedings},
  volume    = {3216},
  pages     = {117--121},
  publisher = {CEUR-WS.org},
  year      = {2022}
}