pm4py.algo.filtering.log.paths.paths_filter module#

class pm4py.algo.filtering.log.paths.paths_filter.Parameters(*values)[source]#

Bases: Enum

ATTRIBUTE_KEY = 'pm4py:param:attribute_key'#
DECREASING_FACTOR = 'decreasingFactor'#
POSITIVE = 'positive'#
TIMESTAMP_KEY = 'pm4py:param:timestamp_key'#
MIN_PERFORMANCE = 'min_performance'#
MAX_PERFORMANCE = 'max_performance'#
pm4py.algo.filtering.log.paths.paths_filter.apply(log: EventLog, paths: List[Tuple[str, str]], parameters: Dict[str | Parameters, Any] | None = None) EventLog[source]#

Apply a filter on traces containing / not containing a path

Parameters:
  • log – Log

  • paths – Paths that we are looking for (expressed as tuple of 2 strings)

  • parameters

    Parameters of the algorithm, including:

    Parameters.ATTRIBUTE_KEY -> Attribute identifying the activity in the log Parameters.POSITIVE -> Indicate if events should be kept/removed

Returns:

Filtered log

Return type:

filtered_log

pm4py.algo.filtering.log.paths.paths_filter.apply_performance(log: EventLog, provided_path: Tuple[str, str], parameters: Dict[str | Parameters, Any] | None = None) EventLog[source]#

Filters the cases of an event log where there is at least one occurrence of the provided path occurring in the defined timedelta range.

Parameters:
  • log – Event log

  • provided_path – Path between two activities (expressed as tuple)

  • parameters

    Parameters of the filter, including:

    Parameters.ATTRIBUTE_KEY -> Attribute identifying the activity in the log Parameters.TIMESTAMP_KEY -> Attribute identifying the timestamp in the log Parameters.POSITIVE -> Indicate if events should be kept/removed Parameters.MIN_PERFORMANCE -> Minimal allowed performance of the provided path Parameters.MAX_PERFORMANCE -> Maximal allowed performance of the provided path

Returns:

Filtered event log

Return type:

filtered_log

pm4py.algo.filtering.log.paths.paths_filter.get_paths_from_log(log, attribute_key='concept:name')[source]#

Get the paths of the log along with their count

Parameters:
  • log – Log

  • attribute_key – Attribute key (must be specified if different from concept:name)

Returns:

Dictionary of paths associated with their count

Return type:

paths

pm4py.algo.filtering.log.paths.paths_filter.get_sorted_paths_list(paths)[source]#

Gets sorted paths list

Parameters:

paths – Dictionary of paths associated with their count

Returns:

Sorted paths list

Return type:

listpaths

pm4py.algo.filtering.log.paths.paths_filter.get_paths_threshold(plist, decreasing_factor)[source]#

Get end attributes cutting threshold

Parameters:
  • plist – List of paths ordered by number of occurrences

  • decreasing_factor – Decreasing factor of the algorithm

Returns:

Paths cutting threshold

Return type:

threshold

pm4py.algo.filtering.log.paths.paths_filter.filter_log_by_paths(log, paths, variants, vc, threshold, attribute_key='concept:name')[source]#

Keep only paths which number of occurrences is above the threshold (or they belong to the first variant)

Parameters:
  • log – Log

  • paths – Dictionary of paths associated with their count

  • variants – (If specified) Dictionary with variant as the key and the list of traces as the value

  • vc – List of variant names along with their count

  • threshold – Cutting threshold (remove paths which number of occurrences is below the threshold)

  • attribute_key – (If specified) Specify the attribute key to use (default concept:name)

Returns:

Filtered log

Return type:

filtered_log