pm4py.util.variants_util module#
- class pm4py.util.variants_util.Parameters(*values)[source]#
Bases:
Enum- ACTIVITY_KEY = 'pm4py:param:activity_key'#
- PARAMETER_VARIANT_DELIMITER = 'variant_delimiter'#
- pm4py.util.variants_util.aggregate_consecutive_activities_in_variants(variants: Dict[Collection[str], int | List], max_repetitions: int = 1) Dict[Collection[str], int | List][source]#
Aggregate the consecutive activities in the variant.
For example, {(‘A’, ‘B’, ‘C’): 3, (‘A’, ‘B’, ‘B’, ‘B’, ‘C’): 2, (‘A’, ‘B’, ‘B’, ‘B’, ‘B’, ‘B’, ‘C’): 1} Would be reduced to: - {(‘A’, ‘B’, ‘C’): 6} if max_repetitions=1 - {(‘A’, ‘B’, ‘C’): 3, (‘A’, ‘B’, ‘B’, ‘C’): 3} if max_repetitions=2 - {(‘A’, ‘B’, ‘C’): 3, (‘A’, ‘B’, ‘B’, ‘B’, ‘C’): 3} if max_repetitions=3 - {(‘A’, ‘B’, ‘C’): 3, (‘A’, ‘B’, ‘B’, ‘B’, ‘C’): 2, (‘A’, ‘B’, ‘B’, ‘B’, ‘B’, ‘C’): 1} if max_repetitions=4
- Parameters:
variants – Dictionary of variants (where each variant is associated to its count (pd.DataFrame) or the list of traces (EventLog))
max_repetitions – Maximum number of consecutive repetitions for an activity
- Returns:
Dictionary of variants aggregated based on the limit of consecutive repetitions for the same activity
- Return type:
aggregated_variants