Skip to content
R Interface between bupaR and the PM4Py Process Mining library
R Python
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
R
docs
inst/python/pm4pytools Update to PM4PY 1.0.21, still some bugs remaining - alignment and eva… Feb 3, 2019
man Forgotten Rd file Jun 8, 2019
tests Update to PM4PY 1.0.21, still some bugs remaining - alignment and eva… Feb 3, 2019
.Rbuildignore Update to PM4Py 1.1.1 and reticulate 1.11 as well as fixes requested … Mar 1, 2019
.gitignore Documentation & Website Mar 4, 2019
.travis.yml Fix shell command Feb 4, 2019
DESCRIPTION Update to PM4Py v1.1.19 Jul 7, 2019
LICENSE.md
NAMESPACE Update to PM4PY 1.1.14 Jun 8, 2019
NEWS.md Update to PM4Py 1.1.1 and reticulate 1.11 as well as fixes requested … Mar 1, 2019
README.md Added CRAN badges Mar 10, 2019
_pkgdown.yml Initial version Jan 24, 2019
pm4py.Rproj

README.md

R Interface to the PM4Py Process Mining Library

CRAN_Status_Badge Travis-CI Build Status

The goal of the R package 'pm4py' is to provide a bridge between bupaR and the Python library PM4Py.

Installation

You can install the development version of pm4py with:

remotes::install_github("fmannhardt/pm4py")

Then, automatically install the pm4py package in a virtual or Conda environment:

pm4py::install_pm4py()

See the 'reticulate' documentation for more information on the available options or how to specify an existing Python environment: https://rstudio.github.io/reticulate/

Example

library(pm4py)

# Most of the data structures are converted in their bupaR equivalents
library(bupaR)

# As Inductive Miner of PM4PY is not life-cycle aware, keep only `complete` events:
patients_completes <- patients[patients$registration_type == "complete", ]

# Discovery with Inductive Miner
pn <- discovery_inductive(patients_completes)

# This results in an auto-converted bupaR Petri net and markings
str(pn)
class(pn$petrinet)

# Render with bupaR
render_PN(pn$petrinet)

# Render with  PM4PY and DiagrammeR
library(DiagrammeR)
viz <- reticulate::import("pm4py.visualization.petrinet")

# Convert back to Python
py_pn <- r_to_py(pn$petrinet)
class(py_pn)

# Render to DOT with PMP4Y
dot <- viz$factory$apply(py_pn)$source
grViz(diagram = dot)

# Compute alignment
alignment <- conformance_alignment(patients_completes, pn$petrinet, pn$initial_marking, pn$final_marking)

# # Alignment is returned in long format as data frame
head(alignment)

# Evaluate model quality
quality <- evaluation_all(patients_completes, pn$petrinet, pn$initial_marking, pn$final_marking)
You can’t perform that action at this time.