pm4py.algo.clustering.trace_attribute_driven.util.filter_subsets module#

class pm4py.algo.clustering.trace_attribute_driven.util.filter_subsets.Parameters(*values)[source]#

Bases: Enum

ATTRIBUTE_KEY = 'pm4py:param:attribute_key'#
ACTIVITY_KEY = 'pm4py:param:activity_key'#
SINGLE = 'single'#
BINARIZE = 'binarize'#
POSITIVE = 'positive'#
LOWER_PERCENT = 'lower_percent'#
pm4py.algo.clustering.trace_attribute_driven.util.filter_subsets.apply_trace_attributes(log, list_of_values, parameters=None)[source]#

Filter log by keeping only traces that has/has not certain case attribute value that belongs to the provided values list

Parameters:
  • log – Trace log

  • values – Allowed attribute values(if it’s numerical value, [] is needed to make it a list)

  • parameters

    Parameters of the algorithm, including:

    activity_key -> Attribute identifying the case in the log positive -> Indicate if events should be kept/removed

Returns:

Filtered log

Return type:

filtered_log

pm4py.algo.clustering.trace_attribute_driven.util.filter_subsets.sublog2varlist(log, freq_thres, num)[source]#

extract lists of variants from selected sublogs together with frequency threshold to filter out infrequent variants :param log: sublog containing the selected case attribute value :param freq_thres: (int) frequency threshold to filter out infrequent variants :return: lists of variant strings

pm4py.algo.clustering.trace_attribute_driven.util.filter_subsets.sublog_percent(log, upper_percent, parameters=None)[source]#

change variant dictionary got from sublog into dataframe, so that we can extract the frequency of each variant :param log: same as sublog2varlist() :param freq_thres: same as sublog2varlist() :return: dataframe of variants with their counts together with the correspond var_list(until the percent )

pm4py.algo.clustering.trace_attribute_driven.util.filter_subsets.sublog_percent2actlist(log, upper_percent, parameters=None)[source]#

just need to var list :param log: same as sublog2varlist() :param freq_thres: same as sublog2varlist() :return: dataframe of variants with their counts together with the correspond var_list(until the percent )

pm4py.algo.clustering.trace_attribute_driven.util.filter_subsets.sublog_percent2varlist(log, upper_percent, parameters=None)[source]#

just need to var list :param log: same as sublog2varlist() :param freq_thres: same as sublog2varlist() :return: dataframe of variants with their counts together with the correspond var_list(until the percent )

pm4py.algo.clustering.trace_attribute_driven.util.filter_subsets.logslice_percent_act(log, unit)[source]#

slice the actlist per unit percent :param log: :param unit: :return:

pm4py.algo.clustering.trace_attribute_driven.util.filter_subsets.apply_variants_filter(log, admitted_variants, parameters=None)[source]#

Filter log keeping/removing only provided variants

Parameters:
  • log – Log object

  • admitted_variants – Admitted variants

  • parameters

    Parameters of the algorithm, including:

    activity_key -> Attribute identifying the activity in the log positive -> Indicate if events should be kept/removed

pm4py.algo.clustering.trace_attribute_driven.util.filter_subsets.logslice_percent(log, unit)[source]#

slice the log per unit percent :param log: :param unit: :return:

pm4py.algo.clustering.trace_attribute_driven.util.filter_subsets.sublog2df_num(log, num)[source]#

change variant dictionary got from sublog into dataframe, so that we can extract the frequency of each variant :param log: same as sublog2varlist() :param freq_thres: same as sublog2varlist() :return: dataframe of variants with their counts

pm4py.algo.clustering.trace_attribute_driven.util.filter_subsets.sublog2df(log, freq_thres, num)[source]#

change variant dictionary got from sublog into dataframe, so that we can extract the frequency of each variant :param log: same as sublog2varlist() :param freq_thres: same as sublog2varlist() :return: dataframe of variants with their counts

pm4py.algo.clustering.trace_attribute_driven.util.filter_subsets.act_dist(var_list_1, var_list_2, log1, log2, freq_thres)[source]#

this function compare the activity similarity between two sublogs via the two lists of variants. :param var_list_1: lists of variants in sublog 1 :param var_list_2: lists of variants in sublog 2 :param freq_thres: same as sublog2df() :param log1: input sublog1 of sublog2df(), which must correspond to var_list_1 :param log2: input sublog2 of sublog2df(), which must correspond to var_list_2 :return: the distance matrix between 2 sublogs in which each element is the distance between two variants.