pm4py.algo.label_splitting.variants.contextual module#

class pm4py.algo.label_splitting.variants.contextual.Parameters(*values)[source]#

Bases: Enum

ACTIVITY_KEY = 'pm4py:param:activity_key'#
CASE_ID_KEY = 'pm4py:param:case_id_key'#
INDEX_KEY = 'index_key'#
TARGET_COLUMN = 'target_column'#
ACTIVITIES_SUFFIX = 'activities_suffix'#
TARGET_ACTIVITIES = 'target_activities'#
PREFIX_LENGTH = 'prefix_length'#
SUFFIX_LENGTH = 'suffix_length'#
MIN_EDGE_WEIGHT = 'min_edge_weight'#
pm4py.algo.label_splitting.variants.contextual.apply(log: EventLog | EventStream | DataFrame, parameters: Dict[Any, Any] | None = None) DataFrame[source]#

Applies the technique of contextual label-splitting, to distinguish between different meanings of the same activity. The result is a Pandas dataframe where the contextual label-splitting has been applied.

Reference paper: van Zelst, Sebastiaan J., et al. “Context-Based Activity Label-Splitting.” International Conference on Business Process Management. Cham: Springer Nature Switzerland, 2023.

Minimum Viable Example:

import pm4py from pm4py.algo.label_splitting import algorithm as label_splitter

log = pm4py.read_xes(“tests/input_data/receipt.xes”) log2 = label_splitter.apply(log, variant=label_splitter.Variants.CONTEXTUAL)

Parameters:
  • log – Event log

  • parameters – Possible parameters of the algorithm, including: - Parameters.PREFIX_LENGTH => the length of the prefix to consider in the context - Parameters.SUFFIX_LENGTH => the length of the suffix to consider in the context - Parameters.MIN_EDGE_WEIGHT => the minimum weight for an edge to be included in the segments graph - Parameters.TARGET_ACTIVITIES => the activities which should be targeted by the relabeling (default: all) - Parameters.TARGET_COLUMN => the column that should contain the re-labeled activity

Returns:

Pandas dataframe with the re-labeling

Return type:

dataframe