Trace exlorer

library(bupaverse)

Different activity sequences in the log can be visualized with trace_explorer(). It can be used to explore frequent as well as infrequent traces.

Set coverage

The coverage argument specifies how much of the log you want to explore. By default it is set at 0.2, meaning that it will show the most frequent traces covering 20% of the event log.

sepsis %>%
    trace_explorer()
## Warning: No `coverage` or `n_traces` set.
## ! Defaulting to `coverage` = 0.2 for `type` = "frequent" traces.

sepsis %>%
    trace_explorer(coverage = 0.15)

You can also set the coverage by directly specifying the number of traces to show.

sepsis %>%
    trace_explorer(n_traces = 10)

Instead of giving priority to frequent traces, you can show infrequent traces.

sepsis %>%
    trace_explorer(n_traces = 10, type = "infrequent")

Set metrics

The trace_explorer() shows three metrics by default:

  • relative coverage of the trace
  • absolute coverage of the trace
  • cumulative coverage of this and previous traces

You can set which metric to include using coverage_labels, as well as change the order.

sepsis %>%
    trace_explorer(n_traces = 10,
                   coverage_labels = c("cumulative", "relative"))

Set labels

The labels shown on the traces can be configured with the arguments label_size, show_labels and abbreviate.

Increasing the label size.

sepsis %>%
    trace_explorer(n_traces = 10, label_size = 4)

Removing the labels.

sepsis %>%
    trace_explorer(n_traces = 10, 
                   show_labels = FALSE)

Disabling the abbreviation of labels.

sepsis %>%
    trace_explorer(n_traces = 10, abbreviate = FALSE)

Set the colors

The colors used can be change by providing a discrete fill scale to scale_fill. The example below uses the default ggplot2 scale.

sepsis %>%
    trace_explorer(n_traces = 10,
                   scale_fill = ggplot2::scale_fill_discrete)


Read more:


Copyright © 2023 bupaR - Hasselt University