pm4py.algo.filtering.log.attributes package

Submodules

pm4py.algo.filtering.log.attributes.attributes_filter module

This file is part of PM4Py (More Info: https://pm4py.fit.fraunhofer.de).

PM4Py is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

PM4Py is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with PM4Py. If not, see <https://www.gnu.org/licenses/>.

class pm4py.algo.filtering.log.attributes.attributes_filter.Parameters(value)[source]

Bases: enum.Enum

An enumeration.

ACTIVITY_KEY = 'pm4py:param:activity_key'
ATTRIBUTE_KEY = 'pm4py:param:attribute_key'
CASE_ID_KEY = 'pm4py:param:case_id_key'
DECREASING_FACTOR = 'decreasingFactor'
KEEP_ONCE_PER_CASE = 'keep_once_per_case'
PARAMETER_KEY_CASE_GLUE = 'case_id_glue'
POSITIVE = 'positive'
STREAM_FILTER_KEY1 = 'stream_filter_key1'
STREAM_FILTER_KEY2 = 'stream_filter_key2'
STREAM_FILTER_VALUE1 = 'stream_filter_value1'
STREAM_FILTER_VALUE2 = 'stream_filter_value2'
pm4py.algo.filtering.log.attributes.attributes_filter.apply(log: pm4py.objects.log.obj.EventLog, values: List[str], parameters: Optional[Dict[Union[str, pm4py.algo.filtering.log.attributes.attributes_filter.Parameters], Any]] = None) pm4py.objects.log.obj.EventLog[source]

Filter log by keeping only traces that has/has not events with an attribute value that belongs to the provided values list

Parameters
  • log – Trace log

  • values – Allowed attributes

  • parameters

    Parameters of the algorithm, including:

    Parameters.ACTIVITY_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.attributes.attributes_filter.apply_auto_filter(log, variants=None, parameters=None)[source]

Apply an attributes filter detecting automatically a percentage

Parameters
  • log – Log

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

  • parameters

    Parameters of the algorithm, including:

    Parameters.DECREASING_FACTOR -> Decreasing factor (stops the algorithm when the next activity by occurrence is below this factor in comparison to previous) Parameters.ATTRIBUTE_KEY -> Attribute key (must be specified if different from concept:name)

Returns

Filtered log

Return type

filtered_log

Deprecated since version 2.2.11: This will be removed in 3.0.0. Removed

pm4py.algo.filtering.log.attributes.attributes_filter.apply_events(log: pm4py.objects.log.obj.EventLog, values: List[str], parameters: Optional[Dict[Union[str, pm4py.algo.filtering.log.attributes.attributes_filter.Parameters], Any]] = None) pm4py.objects.log.obj.EventLog[source]

Filter log by keeping only events with an attribute value that belongs to the provided values list

Parameters
  • log – log

  • values – Allowed attributes

  • parameters

    Parameters of the algorithm, including:

    Parameters.ACTIVITY_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.attributes.attributes_filter.apply_numeric(log: pm4py.objects.log.obj.EventLog, int1: float, int2: float, parameters: Optional[Dict[Union[str, pm4py.algo.filtering.log.attributes.attributes_filter.Parameters], Any]] = None) pm4py.objects.log.obj.EventLog[source]

Apply a filter on cases (numerical filter)

Parameters
  • log – Log

  • int1 – Lower bound of the interval

  • int2 – Upper bound of the interval

  • parameters – Possible parameters of the algorithm

Returns

Filtered dataframe

Return type

filtered_df

pm4py.algo.filtering.log.attributes.attributes_filter.apply_numeric_events(log: pm4py.objects.log.obj.EventLog, int1: float, int2: float, parameters: Optional[Dict[Union[str, pm4py.algo.filtering.log.attributes.attributes_filter.Parameters], Any]] = None) pm4py.objects.log.obj.EventLog[source]

Apply a filter on events (numerical filter)

Parameters
  • log – Log

  • int1 – Lower bound of the interval

  • int2 – Upper bound of the interval

  • parameters

    Possible parameters of the algorithm:

    Parameters.ATTRIBUTE_KEY => indicates which attribute to filter Parameters.POSITIVE => keep or remove traces with such events?

Returns

Filtered log

Return type

filtered_log

pm4py.algo.filtering.log.attributes.attributes_filter.apply_trace_attribute(log: pm4py.objects.log.obj.EventLog, values: List[str], parameters: Optional[Dict[Union[str, pm4py.algo.filtering.log.attributes.attributes_filter.Parameters], Any]] = None) pm4py.objects.log.obj.EventLog[source]

Filter a log on the trace attribute values

Parameters
  • log – Event log

  • values – Allowed/forbidden values

  • parameters

    Parameters of the algorithm, including:
    • Parameters.ATTRIBUTE_KEY: the attribute at the trace level to filter

    • Parameters.POSITIVE: boolean (keep/discard values)

Returns

Filtered log

Return type

filtered_log

pm4py.algo.filtering.log.attributes.attributes_filter.filter_log_by_attributes_threshold(log, attributes, variants, vc, threshold, attribute_key='concept:name')[source]

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

Parameters
  • log – Log

  • attributes – Dictionary of attributes 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 attributes which number of occurrences is below the threshold)

  • attribute_key – (If specified) Specify the activity key in the log (default concept:name)

Returns

Filtered log

Return type

filtered_log

pm4py.algo.filtering.log.attributes.attributes_filter.filter_log_on_max_no_activities(log: pm4py.objects.log.obj.EventLog, max_no_activities: int = 25, parameters: Optional[Dict[Union[str, pm4py.algo.filtering.log.attributes.attributes_filter.Parameters], Any]] = None) pm4py.objects.log.obj.EventLog[source]

Filter a log on a maximum number of activities

Parameters
  • log – Log

  • max_no_activities – Maximum number of activities

  • parameters – Parameters of the algorithm

Returns

Filtered version of the event log

Return type

filtered_log

pm4py.algo.filtering.log.attributes.attributes_filter.filter_log_relative_occurrence_event_attribute(log: pm4py.objects.log.obj.EventLog, min_relative_stake: float, parameters: Optional[Dict[Any, Any]] = None) pm4py.objects.log.obj.EventLog[source]

Filters the event log keeping only the events having an attribute value which occurs: - in at least the specified (min_relative_stake) percentage of events, when Parameters.KEEP_ONCE_PER_CASE = False - in at least the specified (min_relative_stake) percentage of cases, when Parameters.KEEP_ONCE_PER_CASE = True

Parameters
  • log – Event log

  • min_relative_stake – Minimum percentage of cases (expressed as a number between 0 and 1) in which the attribute should occur.

  • parameters – Parameters of the algorithm, including: - Parameters.ATTRIBUTE_KEY => the attribute to use (default: concept:name) - Parameters.KEEP_ONCE_PER_CASE => decides the level of the filter to apply (if the filter should be applied on the cases, set it to True).

Returns

Filtered event log

Return type

filtered_log

Module contents

This file is part of PM4Py (More Info: https://pm4py.fit.fraunhofer.de).

PM4Py is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

PM4Py is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with PM4Py. If not, see <https://www.gnu.org/licenses/>.