The Inductive miner algorithm is provided through the pm4py
package.
library(bupaR)
library(pm4py)
library(petrinetR)
It can be executed through the discovery_inductive
function.
#use only complete timestamp
patients_completes <- patients %>% filter_lifecycle("complete")
discovery_inductive(patients_completes, variant = variant_inductive_only_dfg()) -> PN
## Warning: 'variant_inductive_only_dfg' is deprecated.
## Use 'variant_inductive_imdfb' instead.
## See help("Deprecated")
The resulting object consist of three elements, a net, an initial marking, and a final marking. The net can be visualized using petrinetR as follows.
PN %>% str
## List of 3
## $ petrinet :List of 4
## ..$ places :'data.frame': 8 obs. of 1 variable:
## .. ..$ id: chr [1:8] "p_4" "p_5" "source" "p_7" ...
## ..$ transitions:'data.frame': 10 obs. of 2 variables:
## .. ..$ id : chr [1:10] "Blood test" "Check-out" "skip_3" "skip_1" ...
## .. ..$ label: chr [1:10] "Blood test" "Check-out" NA NA ...
## ..$ flows :'data.frame': 20 obs. of 2 variables:
## .. ..$ from: chr [1:20] "Registration" "Blood test" "Discuss Results" "p_8" ...
## .. ..$ to : chr [1:20] "p_3" "p_5" "p_8" "Check-out" ...
## ..$ marking : chr "source"
## ..- attr(*, "class")= chr "petrinet"
## $ initial_marking: chr "source"
## $ final_marking : chr "sink"
PN$petrinet %>% render_PN()
Currently, the only supported variant is variant_indutice_imdfb
.