DyLoPro package
Submodules
DyLoPro.DynamicLogPlotting module
- class DyLoPro.DynamicLogPlotting.DynamicLogPlots(event_log, case_id_key='case:concept:name', activity_key='concept:name', timestamp_key='time:timestamp', categorical_casefeatures=[], numerical_casefeatures=[], categorical_eventfeatures=[], numerical_eventfeatures=[], start_date=None, end_date=None, outcome=None)[source]
Bases:
objectInitialize a DynamicLogPlots instance by specifying the appropriate arguments.
After successfully initializing a DynamicLogPlots object, all of DyLoPro’s plotting functionalities can invoked by calling the appropriate DynamicLogPlots methods.
- Parameters:
event_log (pandas.DataFrame) – Event log. Events are regarded as instantaneous.
case_id_key (str, optional) – Column name (in event_log) containing the case ID. All events pertaining to the same case should share the same unique case ID. By default ‘case:concept:name’.
activity_key (str, optional) – Column name (in event_log) containing the activity labels. By default ‘concept:name’.
timestamp_key (str, optional) – Column name (in event_log) containing the timestamps for each event. By default ‘time:timestamp’. Should be of a datetime64 dtype.
categorical_casefeatures (list of str, optional) – List of strings containing the column names (in event_log) that correspond to categorical case features. All categorical case features for which you wish to analyze the dynamics over time must be specified in this list first, or alternatively, after having already initialized a DynamicLogPlots object, with the add_categorical_caseft(case_feature) class method. By default []. See Notes for more details on how each categorical case feature column should be formatted.
numerical_casefeatures (list of str, optional) – List of strings containing the column names (in event_log) that correspond to numerical case features. All numerical case features for which you wish to analyze the dynamics over time must be specified in this list first, or alternatively, after having already initialized a DynamicLogPlots object, with the add_numerical_caseft(case_feature) class method. By default []. See Notes for more details on how each numerical case feature column should be formatted.
categorical_eventfeatures (list of str, optional) – List of strings containing the column names (in event_log) that correspond to categorical event features. All categorical event features for which you wish to analyze the dynamics over time must be specified in this list first, or alternatively, after having already initialized a DynamicLogPlots object, with the add_categorical_eventft(event_feature) class method. By default []. See Notes for more details on how each categorical event feature column should be formatted.
numerical_eventfeatures (list of str, optional) – List of strings containing the column names (in event_log) that correspond to numerical event features. All numerical event features for which you wish to analyze the dynamics over time must be specified in this list first, or alternatively, after having already initialized a DynamicLogPlots object, with the add_numerical_eventft(event_feature) class method. By default []. See Notes for more details on how each numerical event feature column should be formatted.
start_date (str, optional) – By default None. If specified, only the cases starting after that date will be included in the dynamic profiling. Should be specified in the following format ‘dd/mm/YYYY’. For example, November 4th 2022 should be specified as start_date=’04/11/2022’.
end_date (str, optional) – By default None. If specified, only the cases ending before that date will be included in the dynamic profiling. Should be specified in the following format ‘dd/mm/YYYY’. For example, November 4th 2022 should be specified as start_date=’04/11/2022’.
outcome (str, optional) – Column name (in event_log) containing the binary case outcome values (if present). By default None. Should be of an integer dtype. See Notes for more details on how an outcome column should be formatted.
Notes
Formatting requirements specified columns in event_log:
categorical_casefeatures : Every column in event_log specified in this list has to be of one of the following dtypes: category, object, boolean. Furthermore, every event (row) pertaining to the same case (i.e. same case ID specified in the case_id_key column) should share the exact same value for each case feature.
numerical_casefeatures : Every column in event_log specified in this list has to be of a numerical dtype. Furthermore, every event (row) pertaining to the same case (i.e. same case ID specified in the case_id_key column) should share the exact same value for each case feature.
categorical_eventfeatures : Every column in event_log specified in this list has to be of one of the following dtypes: category, object, boolean.
numerical_eventfeatures : Every column in event_log specified in this list has to be of a numerical dtype.
outcome: An outcome column in event_log should be of an integer dtype, only contain the values 1 (positive cases) and 0 (negative cases). We regard outcome as case outcomes, and hence every event (row) pertaining to the same case (i.e. same case ID specified in the case_id_key column) should share the exact same value for the outcome.
- add_categorical_caseft(case_feature)[source]
Specify an additional categorical case feature, on top of the one specified upon initializing your DynamicLogPlots instance.
- Parameters:
case_feature (str) – Name of the case_feature column in the log. Column has to be of one of the following dtypes: category, object, boolean.
- add_categorical_eventft(event_feature)[source]
Specify an additional categorical event feature, on top of the one specified upon initializing your DynamicLogPlots instance.
- Parameters:
event_feature (str) – Name of the event_feature column in the log. Column has to be of one of the following dtypes: category, object, boolean.
- add_numerical_caseft(case_feature)[source]
Specify an additional numerical case feature, on top of the one specified upon initializing your DynamicLogPlots instance.
- Parameters:
case_feature (str) – Name of the case_feature column in the log. Column has to be of a numerical dtype.
- add_numerical_eventft(event_feature)[source]
Specify an additional numerical event feature, on top of the one specified upon initializing your DynamicLogPlots instance.
- Parameters:
event_feature (str) – Name of the event_feature column in the log. Column has to be of a numerical dtype.
- dfr_evol(directly_follows_relations, time_unit='days', frequency='weekly', case_assignment='first_event', plt_type='univariate', numeric_agg='mean', xtr_outlier_rem=True)[source]
Plot the time series of the requested aggregations for the Directly-Follows Relations (DFRs) specified in the
directly_follows_relationslist.All cases are grouped into time intervals of which the length is determined by the
frequencyargument. The condition that determines the time interval to which a certain case is assigned, is determined by thecase_assignmentargument. Can be holistically combined with different performance measures by specifying theplt_typeargument. The requested DFR evolutions plotted are arranged in descending order of the number of occurrences of the DFRs.For readability, the DFRs in
directly_follows_relationsare encoded with a number, with DFR 1 being the most frequently occurring DFR, DFR 2 being the second most occurring DFR, and so on. To retrieve a dataframe that maps these DFR numbers to the actual activity pairs, theget_DFR_df()method of theDynamicLogPlotsclass can be called upon.- Parameters:
directly_follows_relations (list of tuple) – The DFRs for which the requested time series will be plotted. Each DFR needs to be specified as a tuple that contains 2 strings, referring to the 2 activities in the DFR, e.g. (‘activity_a’, ‘activity_b’).
time_unit ({'microseconds', 'milliseconds', 'seconds', 'minutes', 'hours', 'days', 'weeks'}) – Time unit in which the throughput time of cases is specified, by default ‘days’.
frequency ({'minutely', '5-minutely', '10-minutely', 'half-hourly', 'hourly' '2-hourly',) – ‘12-hourly’, ‘daily’, ‘weekly’, ‘2-weekly’, ‘monthly’, ‘quarterly’, ‘half-yearly’} Frequency by which the observations are grouped together, by default ‘weekly’.
case_assignment ({'first_event', 'last_event', 'max_events'}) – Determines the condition upon which each case is assigned to a certain period, by default ‘first_event’. For a more detailed explanation of the different case_assignment options, see Notes.
plt_type ({'univariate', 'type_tt', 'type_events_case', 'type_outcome', 'type_dfr_performance'}) – Determines which time series are constructed and visualized, by default ‘univariate’. For a more detailed explanation of the different plt_type options, see Notes.
numeric_agg ({'mean', 'median', 'min', 'max', 'std'}) – Determines how periodic quantities are aggregated, by default ‘mean’. The specified aggregation function will be applied to all the requested time series, except for those quantities that express fractions or counts (if any). For a more detailed explanation of the different numeric_agg options, see Notes.
xtr_outlier_rem (bool, optional) – If True, the vertical ranges of the plots are only determined by regular values, i.e. extreme outliers (>q3 + 3*iqr) in the time series are neglected when determining the vertical range, by default True.
Notes
case_assignmentcan take on the following three values:‘first_event’: Each case is assigned to the time interval in which its first event occurs.
‘last_event’: Each case is assigned to the time interval in which its last event occurs.
‘max_events’: Out of all the time intervals in which the events of a particular case occur, the case is assigned to the interval in which most of its events occur. Ties among time intervals are broken by assigning the case to the first time interval.
plt_typecan take one of the following five values:‘univariate’: For each DFR, the evolutions of the periodically aggregated amount of occurrences per case, as well as the fraction of cases containing at least one occurance of of that DFR, are plotted.
‘type_tt’: For each DFR, next to the univariate plots, also the evolutions of the periodically aggregated Throughput Time (TT) for cases with vs. cases without that DFR are plotted.
‘type_events_case’: For each DFR, next to the univariate plots, also the evolutions of the periodically aggregated case length (in number of events per case (NEPC)) for cases with vs. cases without that DFR are plotted.
‘type_outcome’: For each DFR, next to the univariate plots, also the evolutions of the periodic fractions of cases with a positive outcome (‘outcome=1’) for cases with vs. cases without that DFR, are plotted. (Only applicable if an outcome is already specified upon initialization of the DynamicLogPlots instance, or with the
set_outcomeColumn(outcome)method.)‘type_dfr_performance’: For each DFR, next to the univariate plots, also the evolution of the periodically aggregated DFR performance is plotted. The DFR performance refers to the time elapsed between the first and last activity of that DFR. The time unit in which these periodic performance aggregations are expressed, is automatically determined based on their magnitude. NOTE that the ‘type_dfr_performance’ representation type is a special case, as it is the only representation type in which cases can deliver more than one measure for a certain DFR. I.e. cases that contain more than one occurrence of a certain DFR will also deliver more than one value for the DFR performance to be aggregated over.
numeric_aggcan take on the following five values:‘mean’ : The requested time series are computed by taking the mean for each time interval. E.g. for plt_type=’univariate’, for each time interval, and for each of the DFRs specified in directly_follows_relations, the mean amount of occurrences per case is computed. The fraction of cases containing at least one occurrence of a certain DFR is simply computed by, for each time interval, computing the amount of cases with at least one occurrence, and dividing it by the total amount of cases assigned to that time interval.
‘median’ : The requested time series are computed by taking the median for each time interval. E.g. for plt_type=’type_tt’, for each time interval, and for each of the DFRs specified in directly_follows_relations, the median amount of occurrences per case, the median TT for cases with at least one occurrence of that DFR, and the median TT for all other cases (without an occurrence of that DFR) are computed.
‘min’ : The requested time series are computed by taking the minimum for each time interval. E.g. for plt_type=’type_events_case’, for each time interval, and for each of the DFRs specified in directly_follows_relations, the minimum amount of occurrences per case, the minimum NEPC for cases with at least one occurrence of that DFR, and the minimum NEPC for all other cases (without an occurrence of that DFR) are computed.
‘max’ : The requested time series are computed by taking the maximum for each time interval. E.g. for plt_type=’type_dfr_performance’, for each time interval, and for each of the DFRs specified in directly_follows_relations, the maximum amount of occurrences per case and the maximum DFR performance (i.e. the maximum time elapsed between the occurrence of the first and second activity of that DFR) are computed.
‘std’ : The requested time series are computed by taking the standard deviation for each time interval. E.g. for plt_type=’type_dfr_performance’, for each time interval, and for each of the DFRs specified in directly_follows_relations, the standard deviation of amount of occurrences per case as and the standard deviation of the DFR performances are computed.
- distinct_variants_AdvancedEvol(time_unit='days', frequency='weekly', case_assignment='first_event', plt_type='univariate', numeric_agg='mean', xtr_outlier_rem=True, cases_initialized=True)[source]
Plot the evolution of the requested aggregations over time for:
cases belonging to variants already seen in previous time periods
cases belonging to variants first observed in each time period
All cases are grouped into time intervals of which the length is determined by the
frequencyargument. The condition that determines the time interval to which a certain case is assigned, is determined by thecase_assignmentargument. Can be holistically combined with different performance measures by specifying theplt_typeargument.- Parameters:
time_unit ({'microseconds', 'milliseconds', 'seconds', 'minutes', 'hours', 'days', 'weeks'}) – Time unit in which the throughput time of cases is specified, by default ‘days’.
frequency ({'minutely', '5-minutely', '10-minutely', 'half-hourly', 'hourly' '2-hourly',) – ‘12-hourly’, ‘daily’, ‘weekly’, ‘2-weekly’, ‘monthly’, ‘quarterly’, ‘half-yearly’} Frequency by which the observations are grouped together, by default ‘weekly’.
case_assignment ({'first_event', 'last_event', 'max_events'}) – Determines the condition upon which each case is assigned to a certain period, by default ‘first_event’. For a more detailed explanation of the different case_assignment options, see Notes.
plt_type ({'univariate', 'type_tt', 'type_events_case', 'type_outcome'}) – Determines which time series are constructed and visualized, by default ‘univariate’. For a more detailed explanation of the different plt_type options, see Notes.
numeric_agg ({'mean', 'median', 'min', 'max', 'std'}) – Determines how periodic quantities are aggregated, by default ‘mean’. The specified aggregation function will be applied to all the requested time series, except for those quantities that express fractions or counts (if any). For a more detailed explanation of the different numeric_agg options, see Notes.
xtr_outlier_rem (bool, optional) – If True, the vertical ranges of the plots are only determined by regular values, i.e. extreme outliers (>q3 + 3*iqr) in the time series are neglected when determining the vertical range, by default True.
cases_initialized (bool, optional) – If True, and plt_type!=’univariate’, then the method also plots the evolution of the number of cases initialized in each period on the same graph as the one foreseen for either the Throughput Time (plt_type=’type_tt’), the Number of Events Per Case (plt_type=’type_events_case’) or the fraction of positive cases (plt_type=’type_outcome’), by default True.
Notes
case_assignmentcan take on the following three values:‘first_event’: Each case is assigned to the time interval in which its first event occurs.
‘last_event’: Each case is assigned to the time interval in which its last event occurs.
‘max_events’: Out of all the time intervals in which the events of a particular case occur, the case is assigned to the interval in which most of its events occur. Ties among time intervals are broken by assigning the case to the first time interval.
plt_typecan take one of the following four values:‘univariate’: Plots the periodic evolution of
the absolute amount of distinct variants present in each time period
the absolute amount of distinct new variants introduced in each time period
the fraction of cases belonging to variants already seen in previous time periods
the fraction of cases belonging to variants first observed in each time period
‘type_tt’: Next ot the univariate plots, also plots the periodic evolution of
the aggregated throughput time of cases pertaining to existing variants in each time period
the aggregated throughput time of cases pertaining to new variants in each time period
‘type_events_case’: Next to the univariate plots, also plots the periodic evolution of
the aggregated Number of Events Per Case (NEPC) of cases pertaining to existing variants in each time period
the aggregated Number of Events Per Case (NEPC) of cases pertaining to new variants in each time period
‘type_outcome’: (Only applicable if an outcome is already specified upon initialization of the DynamicLogPlots instance, or with the
set_outcomeColumn(outcome)method.) Next to the univariate plots, also plots the periodic evolution ofthe fraction of cases with outcome=True of cases pertaining to existing variants in each time period
the fraction of cases with outcome=True of cases pertaining to new variants in each time period
numeric_aggcan take on the following five values:‘mean’ : The requested time series are computed by taking the mean for each time period. E.g. for plt_type=’type_tt’, for each time interval, the mean throughput time (TT) of cases pertaining to already existing variants, and the mean TT of cases pertaining to newly introduced variants is computed.
‘median’ : The requested time series are computed by taking the median for each time interval. E.g. for plt_type=’type_events_case’, for each time interval, the median case length (in Number of Events Per Case, aka NEPC) of cases pertaining to already existing variants, and the median NEPC of cases pertaining to newly introduced variants is computed.
‘min’ : The requested time series are computed by taking the minimum for each time interval. E.g. for plt_type=’type_events_case’, for each time interval, the minimum case length (in Number of Events Per Case, aka NEPC) of cases pertaining to already existing variants, and the minimum NEPC of cases pertaining to newly introduced variants is computed.
‘max’ : The requested time series are computed by taking the maximum for each time interval. E.g. for plt_type=’type_tt’, for each time interval, the maximum throughput time (TT) of cases pertaining to already existing variants, and the maximum TT of cases pertaining to newly introduced variants is computed.
‘std’ : The requested time series are computed by taking the standard deviation for each time interval. E.g. for plt_type=’type_tt’, for each time interval, the standard deviation of the throughput time (TT) of cases pertaining to already existing variants, and the standard deviation of the TT of cases pertaining to newly introduced variants is computed.
- distinct_variants_evol(time_unit='days', frequency='weekly', case_assignment='first_event', plt_type='univariate', numeric_agg='mean', xtr_outlier_rem=True, cases_initialized=True)[source]
Deprecated
Deprecated since version 0.1.1:
distinct_variants_evol()method will be removed in DyLoPro 0.2.0 because it duplicates part of the visualization capabilities offered by thedistinct_variants_AdvancedEvol()method. Use the more extensivedistinct_variants_AdvancedEvol()visualization method instead.Plots the number of distinct variants over time, as well as the number of distinct previously unseen / distinct new variants over time.
All cases are grouped into time intervals of which the length is determined by the
frequencyargument. The condition that determines the time interval to which a certain case is assigned, is determined by thecase_assignmentargument. Can be combined with different performance measures by specifying theplt_typeargument.- Parameters:
time_unit ({'microseconds', 'milliseconds', 'seconds', 'minutes', 'hours', 'days', 'weeks'}) – Time unit in which the throughput time of cases is specified, by default ‘days’.
frequency ({'minutely', '5-minutely', '10-minutely', 'half-hourly', 'hourly' '2-hourly',) – ‘12-hourly’, ‘daily’, ‘weekly’, ‘2-weekly’, ‘monthly’, ‘quarterly’, ‘half-yearly’} Frequency by which the observations are grouped together, by default ‘weekly’.
case_assignment ({'first_event', 'last_event', 'max_events'}) – Determines the condition upon which each case is assigned to a certain period, by default ‘first_event’. For a more detailed explanation of the different case_assignment options, see Notes.
plt_type ({'univariate', 'type_tt', 'type_events_case', 'type_outcome'}) – Determines which time series are constructed and visualized, by default ‘univariate’. For a more detailed explanation of the different plt_type options, see Notes.
numeric_agg ({'mean', 'median', 'min', 'max', 'std'}) – Determines how periodic quantities are aggregated, by default ‘mean’. The specified aggregation function will be applied to all the requested time series, except for those quantities that express fractions or counts (if any). For a more detailed explanation of the different numeric_agg options, see Notes.
xtr_outlier_rem (bool, optional) – If True, the vertical ranges of the plots are only determined by regular values, i.e. extreme outliers (>q3 + 3*iqr) in the time series are neglected when determining the vertical range, by default True.
cases_initialized (bool, optional) – If True, and plt_type!=’univariate’, then the method also plots the evolution of the number of cases initialized in each period on the same graph as the one foreseen for either the Throughput Time (plt_type=’type_tt’), the Number of Events Per Case (plt_type=’type_events_case’) or the fraction of positive cases (plt_type=’type_outcome’), by default True.
Notes
case_assignmentcan take on the following three values:‘first_event’: Each case is assigned to the time interval in which its first event occurs.
‘last_event’: Each case is assigned to the time interval in which its last event occurs.
‘max_events’: Out of all the time intervals in which the events of a particular case occur, the case is assigned to the interval in which most of its events occur. Ties among time intervals are broken by assigning the case to the first time interval.
plt_typecan take one of the following four values:‘univariate’: Plots the evolution of the amount of distinct variants present in each time period, as well as the amount of distinct new variants introduced in each time period.
‘type_tt’: Next ot the univariate plots, also plots the evolution of the periodically aggregated Throughput Time (TT) (in the time unit specified by the ‘time_unit’ argument).
‘type_events_case’: Next to the univariate plots, also plots the evolution of the periodically aggregated Number of Events Per Case (NEPC).
‘type_outcome’: Next to the univariate plots, also plots the evolution of the periodically aggregated fraction of cases with outcome = True. (Only applicable if an outcome is already specified upon initialization of the DynamicLogPlots instance, or with the
set_outcomeColumn(outcome)method.)
numeric_aggcan take on the following five values:‘mean’ : The requested time series are computed by taking the mean for each time interval.
‘median’ : The requested time series are computed by taking the median for each time interval.
‘min’ : The requested time series are computed by taking the minimum for each time interval.
‘max’ : The requested time series are computed by taking the maximum for each time interval.
‘std’ : The requested time series are computed by taking the standard deviation for each time interval.
- get_DFR_df(max_k=None, directly_follows_relations=None, counts=False)[source]
Get a pandas.DataFrame containing the DFR numbers together with a tuple containing the two corresponding activity labels of each DFR.
- Parameters:
max_k (int, optional) – If specified, a dataframe containing the DFR numbers and their corresponding activity pairs for the max_k most frequently occurring DFRs is returned. By default None.
directly_follows_relations (list of tuple, optional) – List of tuples containing the specified DFRs. Each DFR needs to be specified as a tuple that contains 2 strings, referring to the 2 activities in the DFR, e.g. (‘activity_a’, ‘activity_b’). If specified and max_k=None, a dataframe containing the DFR numbers and corresponding activity pairs for each of the specified DFRs is returned. If max_k!=None, the DFRs specified here are ignored. By default None.
counts (bool, optional) – If counts=True, the ‘DFR count’ column that contains the number of occurrences of each DFR over the whole event log is included in the returned dataframe.
- Returns:
dfr_df_filtered – Dataframe containing ‘DFR number’ index and the ‘DFR’ column containing for each requested DFR the encoded DFR index and the DFR tuple containing the corresponding activity pair respectively. If counts=True, the ‘DFR count’ column that contains the number of occurrences of each DFR over the whole event log is included too.
- Return type:
pandas.DataFrame
- get_var_df(max_k=None, variants=None, counts=False)[source]
Get a pandas.DataFrame containing the variant numbers together with a tuple containing the activity label strings of each variant.
- Parameters:
max_k (int, optional) – If specified, a dataframe containing the encoded variant numbers and corresponding tuple of N strings (with N the number of activities of a variant) is returned for each of the max_k most frequently occurring variants. By default None.
variants (list of tuple) – The variants for which the requested time series will be plotted. Each variant needs to be specified as a tuple that contains N strings, referring to the N activities that constitute that variant. If specified and max_k=None, a dataframe containing the encoded variant numbers and corresponding tuple of N strings for each of the specified DFRs is returned. If max_k!=None, the variants parameter is ignored. By default None.
counts (bool, optional) – If counts=True, the ‘variant count’ column that contains the number of occurrences of each variant over the whole event log is included in the returned dataframe.
- Returns:
filtered_var_df – Dataframe containing ‘variant number’ index and the ‘variant’ column containing for each requested variant the encoded variant index and the variant tuple containing the corresponding activity pair respectively. If counts=True, the ‘variant count’ column that contains the number of occurrences of each variant over the whole event log is included too.
- Return type:
pandas.DataFrame
- num_casefts_evol(numeric_case_list, time_unit='days', frequency='weekly', case_assignment='first_event', plt_type='univariate', numeric_agg='mean', xtr_outlier_rem=True)[source]
Plots the time series of the requested aggregations over time for the numerical event features specified in the
numeric_case_listargument.All cases are grouped into time intervals of which the length is determined by the
frequencyargument. The condition that determines the time interval to which a certain case is assigned, is determined by thecase_assignmentargument. Can be holistically combined with different performance measures by specifying theplt_typeargument.- Parameters:
numeric_case_list (list of str) – Column names of the numerical case features. All case features already have to be specified, either upon initalization of the DynamicLogPlots object, or with the .add_numerical_caseft(case_feature) class method.
time_unit ({'microseconds', 'milliseconds', 'seconds', 'minutes', 'hours', 'days', 'weeks'}) – Time unit in which the throughput time of cases is specified, by default ‘days’.
frequency ({'minutely', '5-minutely', '10-minutely', 'half-hourly', 'hourly' '2-hourly',) – ‘12-hourly’, ‘daily’, ‘weekly’, ‘2-weekly’, ‘monthly’, ‘quarterly’, ‘half-yearly’} Frequency by which the observations are grouped together, by default ‘weekly’.
case_assignment ({'first_event', 'last_event', 'max_events'}) – Determines the condition upon which each case is assigned to a certain period, by default ‘first_event’. For a more detailed explanation of the different case_assignment options, see Notes.
plt_type ({'univariate', 'type_tt', 'type_events_case', 'type_outcome'}) – Determines which time series are constructed and visualized, by default ‘univariate’. For a more detailed explanation of the different plt_type options, see Notes.
numeric_agg ({'mean', 'median', 'min', 'max', 'std'}) – Determines how periodic quantities are aggregated, by default ‘mean’. The specified aggregation function will be applied to all the requested time series, except for those quantities that express fractions or counts (if any). For a more detailed explanation of the different numeric_agg options, see Notes.
xtr_outlier_rem (bool, optional) – If True, the vertical ranges of the plots are only determined by regular values, i.e. extreme outliers (>q3 + 3*iqr) in the time series are neglected when determining the vertical range, by default True.
Notes
case_assignmentcan take on the following three values:‘first_event’: Each case is assigned to the time interval in which its first event occurs.
‘last_event’: Each case is assigned to the time interval in which its last event occurs.
‘max_events’: Out of all the time intervals in which the events of a particular case occur, the case is assigned to the interval in which most of its events occur. Ties among time intervals are broken by assigning the case to the first time interval.
plt_typecan take one of the following four values:‘univariate’: For each numerical case feature, plots the evolution of its periodical aggregations.
‘type_tt’: For each numerical case feature, next to the univariate plots, also the evolution of the periodically aggregated ratio of Throughput Time (TT) needed per unit of that feature is plotted. The time unit of these periodic ratio aggregations (time unit / unit of feature) is automatically determined based on their magnitude.
‘type_events_case’: For each numerical case feature, next to the univariate plots, also the evolution of the periodically aggregated ratio of Number of Events Per Case (NEPC) needed per 10^(x) units of that feature is plotted. The exponent ‘x’ is automatically determined based on their magnitude.
‘type_outcome’: For each numerical case feature, next to the univariate plots, also the two evolutions of the feature’s periodical aggregations for cases with a positive outcome (‘outcome=1’) vs. cases with a negative outcome (‘outcome=1’) are plotted. (Only applicable if an outcome is already specified upon initialization of the DynamicLogPlots instance, or with the
set_outcomeColumn(outcome)method.)
numeric_aggcan take on the following five values:‘mean’ : The requested time series are computed by taking the mean for each time interval. E.g. for plt_type=’univariate’, for each time interval, and for each numeric case feature specified in numeric_case_list, the mean of all case feature values is is computed.
‘median’ : The requested time series are computed by taking the median for each time interval. E.g. for plt_type=’type_tt’, for each time interval, and for each numeric case feature specified in numeric_case_list, the median of all case feature values as well as the median of all TT ratios are computed.
‘min’ : The requested time series are computed by taking the minimum for each time interval. E.g. for plt_type=’type_events_case’, for each time interval, and for each numeric case feature specified in numeric_case_list, both the minimum of all case feature values and the minimum of all NEPC ratios are computed.
‘max’ : The requested time series are computed by taking the maximum for each time interval. E.g. for plt_type=’type_outcome’, for each time interval, and for each numeric case feature specified in numeric_case_list, the maximum of all case feature values, the maximum of all case feature values for cases with a positive outcome and the maximum of all values for cases with a negative outcome are computed.
‘std’ : The requested time series are computed by taking the standard deviation for each time interval. E.g. for plt_type=’type_tt’, for each time interval, and for each numeric case feature specified in numeric_case_list, the standard deviation of all case feature values as well as the standard deviation of all TT ratios are computed.
- num_eventfts_evol(numeric_event_list, time_unit='days', frequency='weekly', case_assignment='first_event', plt_type='univariate', numeric_agg='mean', xtr_outlier_rem=True, numEventFt_transform='last')[source]
Plot the evolution of the requested aggregations over time for the numerical event features specified in the
numeric_event_listargument.All cases are grouped into time intervals of which the length is determined by the
frequencyargument. The condition that determines the time interval to which a certain case is assigned, is determined by thecase_assignmentargument. Can be holistically combined with different performance measures by specifying theplt_typeargument.In contrast to the numerical case features, numerical event features can take on different values for one and the same case. Therefore, to visualize case-level characteristics over time, an additional abstraction method is needed to project a trace’s sequence of numerical event feature values to a single numeric value. This transformation can be specified by means of the
numEventFt_transformparameter.- Parameters:
numeric_event_list (list of str) – Column names of the numerical event features. All event features already have to be specified, either upon initalization of the DynamicLogPlots object, or with the .add_numerical_eventft(event_feature) class method.
time_unit ({'microseconds', 'milliseconds', 'seconds', 'minutes', 'hours', 'days', 'weeks'}) – Time unit in which the throughput time of cases is specified, by default ‘days’.
frequency ({'minutely', '5-minutely', '10-minutely', 'half-hourly', 'hourly' '2-hourly',) – ‘12-hourly’, ‘daily’, ‘weekly’, ‘2-weekly’, ‘monthly’, ‘quarterly’, ‘half-yearly’} Frequency by which the observations are grouped together, by default ‘weekly’.
case_assignment ({'first_event', 'last_event', 'max_events'}) – Determines the condition upon which each case is assigned to a certain period, by default ‘first_event’. For a more detailed explanation of the different case_assignment options, see Notes.
plt_type ({'univariate', 'type_tt', 'type_events_case', 'type_outcome'}) – Determines which time series are constructed and visualized, by default ‘univariate’. For a more detailed explanation of the different plt_type options, see Notes.
numeric_agg ({'mean', 'median', 'min', 'max', 'std'}) – Determines how periodic quantities are aggregated, by default ‘mean’. The specified aggregation function will be applied to all the requested time series, except for those quantities that express fractions or counts (if any). For a more detailed explanation of the different numeric_agg options, see Notes.
xtr_outlier_rem (bool, optional) – If True, the vertical ranges of the plots are only determined by regular values, i.e. extreme outliers (>q3 + 3*iqr) in the time series are neglected when determining the vertical range, by default True.
numEventFt_transform ({'last', 'first', 'mean', 'median', 'sum', 'prod', 'min', 'max'}) – If any numeric event features contained in ‘event_features’, numEventFt_transform determines the way in which these numerical event features are transformed to the case level. By default ‘last’. For a more detailed explanation of the different numEventFt_transform options, see Notes.
Notes
case_assignmentcan take on the following three values:‘first_event’: Each case is assigned to the time interval in which its first event occurs.
‘last_event’: Each case is assigned to the time interval in which its last event occurs.
‘max_events’: Out of all the time intervals in which the events of a particular case occur, the case is assigned to the interval in which most of its events occur. Ties among time intervals are broken by assigning the case to the first time interval.
plt_typecan take one of the following four values:‘univariate’: For each numerical event feature, plots the evolution of its periodical aggregations.
‘type_tt’: For each numerical event feature, next to the univariate plots, also the evolution of the periodically aggregated ratio of Throughput Time (TT) needed per unit of that feature is plotted. The time unit of these periodic ratio aggregations (time unit / unit of feature) is automatically determined based on their magnitude.
‘type_events_case’: For each numerical event feature, next to the univariate plots, also the evolution of the periodically aggregated ratio of Number of Events Per Case (NEPC) needed per 10^(x) units of that feature is plotted. The exponent ‘x’ is automatically determined based on their magnitude.
‘type_outcome’: For each numerical event feature, next to the univariate plots, also the two evolutions of the feature’s periodical aggregations for cases with a positive outcome (‘outcome=1’) vs. cases with a negative outcome (‘outcome=1’) are plotted. (Only applicable if an outcome is already specified upon initialization of the DynamicLogPlots instance, or with the
set_outcomeColumn(outcome)method.)
numeric_aggcan take on the following five values:‘mean’ : The requested time series are computed by taking the mean for each time interval. E.g. for plt_type=’univariate’, for each time interval, and for each numeric event feature, the mean of all (transformed) values is is computed.
‘median’ : The requested time series are computed by taking the median for each time interval. E.g. for plt_type=’type_tt’, for each time interval, and for each numeric event feature, the median of all (transformed) event feature values as well as the median of all TT ratios are computed.
‘min’ : The requested time series are computed by taking the minimum for each time interval. E.g. for plt_type=’type_events_case’, for each time interval, and for each numeric event feature, both the minimum of all (transformed) values and the minimum of all NEPC ratios are computed.
‘max’ : The requested time series are computed by taking the maximum for each time interval. E.g. for plt_type=’type_outcome’, for each time interval, and for each numeric event feature, both the maximum of all (transformed) values, the maximum of all (transformed) values for cases with a positive outcome and the maximum of all (transformed) values for cases with a negative outcome are computed.
‘std’ : The requested time series are computed by taking the standard deviation for each time interval. E.g. for plt_type=’type_tt’, for each time interval, and for each numeric event feature, the standard deviation of all (transformed) event feature values as well as the standard deviation of all TT ratios are computed.
‘numEventFt_transform’ determines, for each numerical event feature contained in numeric_event_list, how each trace’s sequence of numerical event feature values are projected to a single numeric value. It can take on the following eight values:
‘last’ : Each case is assigned the last non-null entry a numerical event feature.
‘first’ : Each case is assigned the first non-null entry of a numerical event feature.
‘mean’ : Each case is assigned the mean value over all its non-null entries of a numerical event feature.
‘median’ : Each case is assigned the median value over all its non-null entries of a numerical event feature.
‘sum’ : Each case is assigned the sum over all its non-null entries of a numerical event feature.
‘prod’ : Each case is assigned the product over all its non-null entries of a numerical event feature.
‘min’ : Each case is assigned the minimum value over all its non-null entries of a numerical event feature.
‘max’ : Each case is assigned the maximum value over all its non-null entries of a numerical event feature.
- select_time_range(start_date=None, end_date=None)[source]
Select only those traces starting after start_date, and ending before end_date.
- Parameters:
start_date (str, optional) – Start date string of format “dd/mm/YYYY”, by default None
end_date (str, optional) – End date string of format “dd/mm/YYYY”, by default None
- set_outcomeColumn(outcome)[source]
Specify an outcome column, or change the outcome column in case one has already been specified.
- Parameters:
outcome (str) – Name of the outcome column in the log. (Has to be a binary outcome column with 0 and 1’s, and this value has to be constant over all events pertaining to the same case.)
- topK_categorical_caseftr_evol(case_feature, time_unit='days', frequency='weekly', case_assignment='first_event', plt_type='univariate', numeric_agg='mean', max_k=10, xtr_outlier_rem=True)[source]
Plot the time series of the requested aggregations for each of the
max_kmost frequently occurring levels of categorical case feature ‘case_feature’. Ifmax_kis greater than or equal to the cardinality of that feature, the requested time series for all levels are plotted.All cases are grouped into time intervals of which the length is determined by the
frequencyargument. The condition that determines the time interval to which a certain case is assigned, is determined by thecase_assignmentargument. Can be holistically combined with different performance measures by specifying theplt_typeargument. The requested level time series plotted are arranged in descending order of the number of occurrences of the levels.- Parameters:
case_feature (str) – Column name of the categorical case feature. The case feature already has to be specified, either upon initalization of the DynamicLogPlots object, or with the .add_categorical_caseft(case_feature) class method.
time_unit ({'microseconds', 'milliseconds', 'seconds', 'minutes', 'hours', 'days', 'weeks'}) – Time unit in which the throughput time of cases is specified, by default ‘days’.
frequency ({'minutely', '5-minutely', '10-minutely', 'half-hourly', 'hourly' '2-hourly',) – ‘12-hourly’, ‘daily’, ‘weekly’, ‘2-weekly’, ‘monthly’, ‘quarterly’, ‘half-yearly’} Frequency by which the observations are grouped together, by default ‘weekly’.
case_assignment ({'first_event', 'last_event', 'max_events'}) – Determines the condition upon which each case is assigned to a certain period, by default ‘first_event’. For a more detailed explanation of the different case_assignment options, see Notes.
plt_type ({'univariate', 'type_tt', 'type_events_case', 'type_outcome'}) – Determines which time series are constructed and visualized, by default ‘univariate’. For a more detailed explanation of the different plt_type options, see Notes.
numeric_agg ({'mean', 'median', 'min', 'max', 'std'}) – Determines how periodic quantities are aggregated, by default ‘mean’. The specified aggregation function will be applied to all the requested time series, except for those quantities that express fractions or counts (if any). For a more detailed explanation of the different numeric_agg options, see Notes.
max_k (int, optional) – Only the max_k most frequently occurring levels of ‘case_feature’ are considered, by default 10.
xtr_outlier_rem (bool, optional) – If True, the vertical ranges of the plots are only determined by regular values, i.e. extreme outliers (>q3 + 3*iqr) in the time series are neglected when determining the vertical range, by default True.
Notes
case_assignmentcan take on the following three values:‘first_event’: Each case is assigned to the time interval in which its first event occurs.
‘last_event’: Each case is assigned to the time interval in which its last event occurs.
‘max_events’: Out of all the time intervals in which the events of a particular case occur, the case is assigned to the interval in which most of its events occur. Ties among time intervals are broken by assigning the case to the first time interval.
plt_typecan take one of the following four values:‘univariate’: For each level, plots the evolution of the periodic fraction of cases for which case_feature=’level’.
‘type_tt’: For each level, next to the univariate plots, also the evolutions of the periodically aggregated Throughput Time (TT) for cases with case_feature=’level’ vs. all other cases (case_feature!=’level’), are plotted.
‘type_events_case’: For each level, next to the univariate plots, also the evolutions of the periodically aggregated case length (in Number of Events Per Case (NEPC)) for cases with case_feature=’level’ vs. all other cases (case_feature!=’level’), are plotted.
‘type_outcome’: For each level, next to the univariate plots, also the evolutions of the periodic fractions of cases with a positive outcome (‘outcome=1’) for cases with case_feature=’level’ vs. all other cases (case_feature!=’level’), are plotted. (Only applicable if an outcome is already specified upon initialization of the DynamicLogPlots instance, or with the
set_outcomeColumn(outcome)method.)
numeric_aggcan take on the following five values:‘mean’ : The requested time series are computed by taking the mean for each time interval. E.g. for plt_type=’type_tt’, for each time interval, and for each of the max_k levels of case_feature, the mean TT for cases with case_feature=’level’, and the mean TT for all other cases (with case_feature!=’level’) are computed.
‘median’ : The requested time series are computed by taking the median for each time interval. E.g. for plt_type=’type_events_case’, for each time interval, and for each of the max_k levels of case_feature, the median NEPC for cases with case_feature=’level’, and the median NEPC for all other cases (with case_feature!=’level’) are computed.
‘min’ : The requested time series are computed by taking the minimum for each time interval. E.g. for plt_type=’type_events_case’, for each time interval, and for each of the max_k levels of case_feature, the minimum NEPC among cases with case_feature=’level’, and the minimum NEPC among all other cases (with case_feature!=’level’) are computed.
‘max’ : The requested time series are computed by taking the maximum for each time interval. E.g. for plt_type=’type_tt’, for each time interval, and for each of the max_k levels of case_feature, the maximum TT among cases with case_feature=’level’, and the maximum TT among all other cases (with case_feature!=’level’) are computed.
‘std’ : The requested time series are computed by taking the standard deviation for each time interval. E.g. for plt_type=’type_tt’, for each time interval, and for each of the max_k levels of case_feature, the standard deviation of the TT among cases with case_feature=’level’, and the standard deviation of the TT of all other cases (with case_feature!=’level’) are computed.
- topK_categorical_eventftr_evol(event_feature, time_unit='days', frequency='weekly', case_assignment='first_event', plt_type='univariate', numeric_agg='mean', max_k=10, xtr_outlier_rem=True)[source]
Plot the time series of the requested aggregations for each of the
max_kmost frequently occurring levels of categorical event featureevent_feature. Ifmax_kis greater than or equal to the cardinality of that feature, the requested time series for all levels are plotted.All cases are grouped into time intervals of which the length is determined by the
frequencyargument. The condition that determines the time interval to which a certain case is assigned, is determined by thecase_assignmentargument. Can be holistically combined with different performance measures by specifying theplt_typeargument. The requested level time series plotted are arranged in descending order of the number of occurrences of each level.- Parameters:
event_feature (str) – Column name of the categorical event feature. The event feature already has to be specified, either upon initalization of the DynamicLogPlots object, or with the .add_categorical_eventft(event_feature) class method.
time_unit ({'microseconds', 'milliseconds', 'seconds', 'minutes', 'hours', 'days', 'weeks'}) – Time unit in which the throughput time of cases is specified, by default ‘days’.
frequency ({'minutely', '5-minutely', '10-minutely', 'half-hourly', 'hourly' '2-hourly',) – ‘12-hourly’, ‘daily’, ‘weekly’, ‘2-weekly’, ‘monthly’, ‘quarterly’, ‘half-yearly’} Frequency by which the observations are grouped together, by default ‘weekly’.
case_assignment ({'first_event', 'last_event', 'max_events'}) – Determines the condition upon which each case is assigned to a certain period, by default ‘first_event’. For a more detailed explanation of the different case_assignment options, see Notes.
plt_type ({'univariate', 'type_tt', 'type_events_case', 'type_outcome'}) – Determines which time series are constructed and visualized, by default ‘univariate’. For a more detailed explanation of the different plt_type options, see Notes.
numeric_agg ({'mean', 'median', 'min', 'max', 'std'}) – Determines how periodic quantities are aggregated, by default ‘mean’. The specified aggregation function will be applied to all the requested time series, except for those quantities that express fractions or counts (if any). For a more detailed explanation of the different numeric_agg options, see Notes.
max_k (int, optional) – Only the max_k most frequently occurring levels of ‘event_feature’ are considered, by default 10.
xtr_outlier_rem (bool, optional) – If True, the vertical ranges of the plots are only determined by regular values, i.e. extreme outliers (>q3 + 3*iqr) in the time series are neglected when determining the vertical range, by default True.
Notes
case_assignmentcan take on the following three values:‘first_event’: Each case is assigned to the time interval in which its first event occurs.
‘last_event’: Each case is assigned to the time interval in which its last event occurs.
‘max_events’: Out of all the time intervals in which the events of a particular case occur, the case is assigned to the interval in which most of its events occur. Ties among time intervals are broken by assigning the case to the first time interval.
plt_typecan take one of the following four values:‘univariate’: For each level, plots the evolution of the periodic fraction of cases for which at least one event satisfies event_feature=’level’.
‘type_tt’: For each level, next to the univariate plots, also the evolutions of the periodically aggregated Throughput Time (TT) for cases with at least one occurrence of event_feature=’level’ vs. all other cases (event_feature!=’level’ for all events), are plotted.
‘type_events_case’: For each level, next to the univariate plots, also the evolutions of the periodically aggregated case length (in Number of Events Per Case (NEPC)) for cases with at least one occurrence of event_feature=’level’ vs. all other cases (event_feature!=’level’ for all events), are plotted.
‘type_outcome’: For each level, next to the univariate plots, also the evolutions of the periodic fractions of cases with a positive outcome (‘outcome=1’) for cases with at least one occurrence of event_feature=’level’ vs. all other cases (event_feature!=’level’ for all events), are plotted. (Only applicable if an outcome is already specified upon initialization of the DynamicLogPlots instance, or with the
set_outcomeColumn(outcome)method.)
numeric_aggcan take on the following five values:‘mean’ : The requested time series are computed by taking the mean for each time interval. E.g. for plt_type=’type_tt’, for each time interval, and for each of the max_k levels of event_feature, the mean TT for cases with at least one occurrence of event_feature=’level’, and the mean TT for all other cases (with event_feature!=’level’ for all events) are computed.
‘median’ : The requested time series are computed by taking the median for each time interval. E.g. for plt_type=’type_events_case’, for each time interval, and for each of the max_k levels of event_feature, the median NEPC for cases with at least one occurrence of event_feature=’level’, and the median NEPC for all other cases (with event_feature!=’level’ for all events) are computed.
‘min’ : The requested time series are computed by taking the minimum for each time interval. E.g. for plt_type=’type_events_case’, for each time interval, and for each of the max_k levels of event_feature, the minimum NEPC among cases with at least one occurrence of event_feature=’level’, and the minimum NEPC among all other cases (with event_feature!=’level’ for all events) are computed.
‘max’ : The requested time series are computed by taking the maximum for each time interval. E.g. for plt_type=’type_tt’, for each time interval, and for each of the max_k levels of event_feature, the maximum TT among cases with at least one occurrence of event_feature=’level’, and the maximum TT among all other cases (with event_feature!=’level’ for all events) are computed.
‘std’ : The requested time series are computed by taking the standard deviation for each time interval. E.g. for plt_type=’type_tt’, for each time interval, and for each of the max_k levels of event_feature, the standard deviation of the TT among cases with at least one occurrence of event_feature=’level’, and the standard deviation of the TT of all other cases (with event_feature!=’level’ for all events) are computed.
- topK_dfr_evol(time_unit='days', frequency='weekly', case_assignment='first_event', plt_type='univariate', numeric_agg='mean', max_k=10, xtr_outlier_rem=True)[source]
Plot the time series of the requested aggregations for each of the
max_kmost frequently occurring Directly-Follows Relations (DFRs).All cases are grouped into time intervals of which the length is determined by the
frequencyargument. The condition that determines the time interval to which a certain case is assigned, is determined by thecase_assignmentargument. Can be holistically combined with different performance measures by specifying theplt_typeargument. The requested DFR evolutions plotted are arranged in descending order of the number of occurrences of the DFRs.For readability, the DFRs are encoded with a number with DFR 1 being the most frequently occurring DFR, and DFR
max_kbeing the max_k’th most occurring DFR. To retrieve a dataframe that maps these DFR numbers to the actual activity pairs, theget_DFR_df()method of theDynamicLogPlotsclass can be called upon.- Parameters:
time_unit ({'microseconds', 'milliseconds', 'seconds', 'minutes', 'hours', 'days', 'weeks'}) – Time unit in which the throughput time of cases is specified, by default ‘days’.
frequency ({'minutely', '5-minutely', '10-minutely', 'half-hourly', 'hourly' '2-hourly',) – ‘12-hourly’, ‘daily’, ‘weekly’, ‘2-weekly’, ‘monthly’, ‘quarterly’, ‘half-yearly’} Frequency by which the observations are grouped together, by default ‘weekly’.
case_assignment ({'first_event', 'last_event', 'max_events'}) – Determines the condition upon which each case is assigned to a certain period, by default ‘first_event’. For a more detailed explanation of the different case_assignment options, see Notes.
plt_type ({'univariate', 'type_tt', 'type_events_case', 'type_outcome', 'type_dfr_performance'}) – Determines which time series are constructed and visualized, by default ‘univariate’. For a more detailed explanation of the different plt_type options, see Notes.
numeric_agg ({'mean', 'median', 'min', 'max', 'std'}) – Determines how periodic quantities are aggregated, by default ‘mean’. The specified aggregation function will be applied to all the requested time series, except for those quantities that express fractions or counts (if any). For a more detailed explanation of the different numeric_agg options, see Notes.
max_k (int, optional) – Only the max_k most frequently occurring DFRs are considered, by default 10.
xtr_outlier_rem (bool, optional) – If True, the vertical ranges of the plots are only determined by regular values, i.e. extreme outliers (>q3 + 3*iqr) in the time series are neglected when determining the vertical range, by default True.
Notes
case_assignmentcan take on the following three values:‘first_event’: Each case is assigned to the time interval in which its first event occurs.
‘last_event’: Each case is assigned to the time interval in which its last event occurs
‘max_events’: Out of all the time intervals in which the events of a particular case occur, the case is assigned to the interval in which most of its events occur. Ties among time intervals are broken by assigning the case to the first time interval.
plt_typecan take one of the following five values:‘univariate’: For each DFR, the evolutions of the periodically aggregated amount of occurrences per case, as well as the fraction of cases containing at least one occurance of of that DFR, are plotted.
‘type_tt’: For each DFR, next to the univariate plots, also the evolutions of the periodically aggregated Throughput Time (TT) for cases with vs. cases without that DFR are plotted.
‘type_events_case’: For each DFR, next to the univariate plots, also the evolutions of the periodically aggregated case length (in number of events per case (NEPC)) for cases with vs. cases without that DFR are plotted.
‘type_outcome’: For each DFR, next to the univariate plots, also the evolutions of the periodic fractions of cases with a positive outcome (‘outcome=1’) for cases with vs. cases without that DFR, are plotted. (Only applicable if an outcome is already specified upon initialization of the DynamicLogPlots instance, or with the
set_outcomeColumn(outcome)method.)‘type_dfr_performance’: For each DFR, next to the univariate plots, also the evolution of the periodically aggregated DFR performance is plotted. The DFR performance refers to the time elapsed between the first and last activity of that DFR. The time unit in which these periodic performance aggregations are expressed, is automatically determined based on their magnitude. NOTE that the ‘type_dfr_performance’ representation type is a special case, as it is the only representation type in which cases can deliver more than one measure for a certain DFR. I.e. cases that contain more than one occurrence of a certain DFR will also deliver more than one value for the DFR performance to be aggregated over.
numeric_aggcan take on the following five values:‘mean’ : The requested time series are computed by taking the mean for each time interval. E.g. for plt_type=’univariate’, for each time interval, and for each of the max_k DFRs, the mean amount of occurrences per case is computed. The fraction of cases containing at least one occurrence of a certain DFR is simply computed by, for each time interval, computing the amount of cases with at least one occurrence, and dividing it by the total amount of cases assigned to that time interval.
‘median’ : The requested time series are computed by taking the median for each time interval. E.g. for plt_type=’type_tt’, for each time interval, and for each of the max_k DFRs, the median amount of occurrences per case, the median TT for cases with at least one occurrence of that DFR, and the median TT for all other cases (without an occurrence of that DFR) are computed.
‘min’ : The requested time series are computed by taking the minimum for each time interval. E.g. for plt_type=’type_events_case’, for each time interval, and for each of the max_k DFRs, the minimum amount of occurrences per case, the minimum NEPC for cases with at least one occurrence of that DFR, and the minimum NEPC for all other cases (without an occurrence of that DFR) are computed.
‘max’ : The requested time series are computed by taking the maximum for each time interval. E.g. for plt_type=’type_dfr_performance’, for each time interval, and for each of the max_k DFRs, the maximum amount of occurrences per case and the maximum DFR performance (i.e. the maximum time elapsed between the occurrence of the first and second activity of that DFR) are computed.
‘std’ : The requested time series are computed by taking the standard deviation for each time interval. E.g. for plt_type=’type_dfr_performance’, for each time interval, and for each of the max_k DFRs, the standard deviation of amount of occurrences per case as and the standard deviation of the DFR performances are computed.
- topK_variants_evol(time_unit='days', frequency='weekly', case_assignment='first_event', plt_type='univariate', numeric_agg='mean', max_k=10, xtr_outlier_rem=True)[source]
Plot the time series of the requested aggregations for each of the
max_kmost frequently occurring variants.All cases are grouped into time intervals of which the length is determined by the
frequencyargument. The condition that determines the time interval to which a certain case is assigned, is determined by thecase_assignmentargument. Can be holistically combined with different performance measures by specifying theplt_typeargument. The requested variant time series plotted are arranged in descending order of the number of occurrences of the variants.For readability, the variants are encoded with a number, with variant 1 being the most frequently occurring variant, and variant
max_kbeing the max_k’th most occurring variant. To retrieve a dataframe that maps these variant numbers to the actual activity sequences, theget_var_df()method of theDynamicLogPlotsclass can be called upon.- Parameters:
time_unit ({'microseconds', 'milliseconds', 'seconds', 'minutes', 'hours', 'days', 'weeks'}) – Time unit in which the throughput time of cases is specified, by default ‘days’.
frequency ({'minutely', '5-minutely', '10-minutely', 'half-hourly', 'hourly' '2-hourly',) – ‘12-hourly’, ‘daily’, ‘weekly’, ‘2-weekly’, ‘monthly’, ‘quarterly’, ‘half-yearly’} Frequency by which the observations are grouped together, by default ‘weekly’.
case_assignment ({'first_event', 'last_event', 'max_events'}) – Determines the condition upon which each case is assigned to a certain period, by default ‘first_event’. For a more detailed explanation of the different case_assignment options, see Notes.
plt_type ({'univariate', 'type_tt', 'type_outcome'}) – Determines which time series are constructed and visualized, by default ‘univariate’. For a more detailed explanation of the different plt_type options, see Notes.
numeric_agg ({'mean', 'median', 'min', 'max', 'std'}) – Determines how periodic quantities are aggregated, by default ‘mean’. The specified aggregation function will be applied to all the requested time series, except for those quantities that express fractions or counts (if any). For a more detailed explanation of the different numeric_agg options, see Notes.
max_k (int, optional) – Only the max_k most frequently occurring variants are considered, by default 10.
xtr_outlier_rem (bool, optional) – If True, the vertical ranges of the plots are only determined by regular values, i.e. extreme outliers (>q3 + 3*iqr) in the time series are neglected when determining the vertical range, by default True.
Notes
case_assignmentcan take on the following three values:‘first_event’: Each case is assigned to the time interval in which its first event occurs.
‘last_event’: Each case is assigned to the time interval in which its last event occurs.
‘max_events’: Out of all the time intervals in which the events of a particular case occur, the case is assigned to the interval in which most of its events occur. Ties among time intervals are broken by assigning the case to the first time interval.
plt_typecan take one of the following three values:‘univariate’: For each variant, plots the evolution of the periodic fraction of cases for accounted for by that variant.
‘type_tt’: For each variant, next to the univariate plots, also the evolutions of the periodically aggregated Throughput Time (TT) for cases belonging to that variant vs. all other cases (not belonging to that variant), are plotted.
‘type_outcome’: For each variant, next to the univariate plots, also the evolutions of the periodic fractions of cases with a positive outcome (‘outcome=1’) for cases belonging to that variant vs. all other cases (not belonging to that variant), are plotted. (Only applicable if an outcome is already specified upon initialization of the DynamicLogPlots instance, or with the
set_outcomeColumn(outcome)method.)
numeric_aggcan take on the following five values:‘mean’ : The requested time series are computed by taking the mean for each time interval. E.g. for plt_type=’type_tt’, for each time interval, and for each of the max_k variants, the mean TT for cases belonging to that variant, and the mean TT for all other cases (belonging to other variants) are computed.
‘median’ : The requested time series are computed by taking the median for each time interval. E.g. for plt_type=’type_tt’, for each time interval, and for each of the max_k variants, the median TT for cases belonging to that variant, and the median TT for all other cases (belonging to other variants) are computed.
‘min’ : The requested time series are computed by taking the minimum for each time interval. E.g. for plt_type=’type_tt’, for each time interval, and for each of the max_k variants, the minimum TT among cases belonging to that variant, and the minimum TT among all other cases (belonging to other variants) are computed.
‘max’ : The requested time series are computed by taking the maximum for each time interval. E.g. for plt_type=’type_tt’, for each time interval, and for each of the max_k variants, the maximum TT among cases belonging to that variant, and the maximum TT among all other cases (belonging to other variants) are computed.
‘std’ : The requested time series are computed by taking the standard deviation for each time interval. E.g. for plt_type=’type_tt’, for each time interval, and for each of the max_k variants, the standard deviation of the TT for cases belonging to that variant, and the standard deviation of the TT for all other cases (belonging to other variants) are computed.
- variants_evol(variants, time_unit='days', frequency='weekly', case_assignment='first_event', plt_type='univariate', numeric_agg='mean', xtr_outlier_rem=True)[source]
Plot the time series of the requested aggregations for the variants specified in the
variantslist.All cases are grouped into time intervals of which the length is determined by the
frequencyargument. The condition that determines the time interval to which a certain case is assigned, is determined by thecase_assignmentargument. Can be holistically combined with different performance measures by specifying theplt_typeargument. The requested variant time series plotted are arranged in descending order of the number of occurrences of the variants.For readability, the variants are encoded with a number, with variant 1 being the most frequently occurring variant, variant 2 being the second most occurring variant, and so on. To retrieve a dataframe that maps these variant numbers to the actual activity sequences, the
get_var_df()method of theDynamicLogPlotsclass can be called upon.- Parameters:
variants (list of tuple) – The variants for which the requested time series will be plotted. Each variant needs to be specified as a tuple that contains N strings, referring to the N activities that constitute that variant.
time_unit ({'microseconds', 'milliseconds', 'seconds', 'minutes', 'hours', 'days', 'weeks'}) – Time unit in which the throughput time of cases is specified, by default ‘days’.
frequency ({'minutely', '5-minutely', '10-minutely', 'half-hourly', 'hourly' '2-hourly',) – ‘12-hourly’, ‘daily’, ‘weekly’, ‘2-weekly’, ‘monthly’, ‘quarterly’, ‘half-yearly’} Frequency by which the observations are grouped together, by default ‘weekly’.
case_assignment ({'first_event', 'last_event', 'max_events'}) – Determines the condition upon which each case is assigned to a certain period, by default ‘first_event’. For a more detailed explanation of the different case_assignment options, see Notes.
plt_type ({'univariate', 'type_tt', 'type_outcome'}) – Determines which time series are constructed and visualized, by default ‘univariate’. For a more detailed explanation of the different plt_type options, see Notes.
numeric_agg ({'mean', 'median', 'min', 'max', 'std'}) – Determines how periodic quantities are aggregated, by default ‘mean’. The specified aggregation function will be applied to all the requested time series, except for those quantities that express fractions or counts (if any). For a more detailed explanation of the different numeric_agg options, see Notes.
xtr_outlier_rem (bool, optional) – If True, the vertical ranges of the plots are only determined by regular values, i.e. extreme outliers (>q3 + 3*iqr) in the time series are neglected when determining the vertical range, by default True.
Notes
case_assignmentcan take on the following three values:‘first_event’: Each case is assigned to the time interval in which its first event occurs.
‘last_event’: Each case is assigned to the time interval in which its last event occurs.
‘max_events’: Out of all the time intervals in which the events of a particular case occur, the case is assigned to the interval in which most of its events occur. Ties among time intervals are broken by assigning the case to the first time interval.
plt_typecan take one of the following three values:‘univariate’: For each variant, plots the evolution of the periodic fraction of cases accounted for by that variant.
‘type_tt’: For each variant, next to the univariate plots, also the evolutions of the periodically aggregated Throughput Time (TT) for cases belonging to that variant vs. all other cases (not belonging to that variant), are plotted.
‘type_outcome’: For each variant, next to the univariate plots, also the evolutions of the periodic fractions of cases with a positive outcome (‘outcome=1’) for cases belonging to that variant vs. all other cases (not belonging to that variant), are plotted. (Only applicable if an outcome is already specified upon initialization of the DynamicLogPlots instance, or with the
set_outcomeColumn(outcome)method.)
numeric_aggcan take on the following five values:‘mean’ : The requested time series are computed by taking the mean for each time interval. E.g. for plt_type=’type_tt’, for each time interval, and for each variant specified in variants, the mean TT for cases belonging to that variant, and the mean TT for all other cases (belonging to other variants) are computed.
‘median’ : The requested time series are computed by taking the median for each time interval. E.g. for plt_type=’type_tt’, for each time interval, and for each variant specified in variants, the median TT for cases belonging to that variant, and the median TT for all other cases (belonging to other variants) are computed.
‘min’ : The requested time series are computed by taking the minimum for each time interval. E.g. for plt_type=’type_tt’, for each time interval, and for each variant specified in variants, the minimum TT among cases belonging to that variant, and the minimum TT among all other cases (belonging to other variants) are computed.
‘max’ : The requested time series are computed by taking the maximum for each time interval. E.g. for plt_type=’type_tt’, for each time interval, and for each variant specified in variants, the maximum TT among cases belonging to that variant, and the maximum TT among all other cases (belonging to other variants) are computed.
‘std’ : The requested time series are computed by taking the standard deviation for each time interval. E.g. for plt_type=’type_tt’, for each time interval, and for each variant specified in variants, the standard deviation of the TT for cases belonging to that variant, and the standard deviation of the TT for all other cases (belonging to other variants) are computed.
DyLoPro.check_args module
DyLoPro.plot_components module
General function called upon by every plotting function.
- DyLoPro.plot_components.plt_period(x, y, axes, y_label, number=None, max_k=None, title=None, label=None, location=None, color=None)[source]
Generic plotting function. 4 options:
Data needs to be plotted on a figure with 1 other plot, with each of the 2 plots a different vertical axis (left and right). This data is assigned to the left vertical axis. Needed arguments: the required arguments, label = string, location = ‘left’, color = string.
Data needs to be plotted on a figure with 1 other plot, with each of the 2 plots a different vertical axis (left and right). This data is assigned to the right vertical axis. Needed arguments: the required arguments, label = string, location = ‘right’, color = string.
Data needs to be plotted on a figure that will not contain any other plots. Needed arguments: the required arguments, title = string.
Data needs to be plotted on a figure that will contain several other plots, but all of the same quantity / unit. Hence, only one vertical axis (the left one) will be used by max_k plots. Needed arguments: the required arguments, number = int, max_k = int, title = string, label = string.
- Parameters:
x (_type_) – _description_
y (_type_) – _description_
axes (_type_) – _description_
y_label (_type_) – _description_
number (_type_, optional) – _description_, by default None
max_k (_type_, optional) – _description_, by default None
title (_type_, optional) – _description_, by default None
label (_type_, optional) – _description_, by default None
location (_type_, optional) – _description_, by default None
color (_type_, optional) – _description_, by default None
DyLoPro.plotting_utils module
- DyLoPro.plotting_utils.determine_time_col(frequency, case_assignment)[source]
Determine the time period column (‘time_col’) that indicates to which time period each case should be assigned too.
- Parameters:
frequency ({'minutely', '5-minutely', '10-minutely', 'half-hourly', 'hourly' '2-hourly', '12-hourly', 'daily', 'weekly', '2-weekly', 'monthly', 'quarterly', 'half-yearly'}) – Determines the intervals of time periods to which cases are assigned.
case_assignment ({'first_event', 'last_event', 'max_events'}) – Given the time intervals determined by ‘frequency’, ‘case_assigment’ determines the the condition upon which each case is assigned to a certain time period.
- Returns:
time_col – Time period column that contains for each case the time period it should be assigned to.
- Return type:
str
- DyLoPro.plotting_utils.determine_tt_col(time_unit)[source]
Determine the appropriate time unit column for the throughput time based on the
time_unitargument specified by the user.- Parameters:
time_unit ({'microseconds', 'milliseconds', 'seconds', 'minutes',) – ‘hours’, ‘days’, ‘weeks’} Time unit for the throughput time specified by the user.
- Returns:
tt_col – Column name throughput time with correct unit in the preprocessed event log.
- Return type:
str
- DyLoPro.plotting_utils.get_dfr_time(log, case_log, dfr_list, time_col, numeric_agg)[source]
Compute, for each case, the DFR performance (i.e. time elapsed between the occurrence of the first and second activity of a given Directly-Follows Relationship (DFR)) for each occurrence of each DFR in
dfr_list. Then, the cases are grouped into discrete time buckets, producing for each DFR a set of DFR performances. Finally, for each of the DFRs indfr_list, an aggregate DFR perforamnce is computed for each time bucket, with the aggregation function being determined by thenumeric_aggparameter.- Parameters:
log (pd.DataFrame) – The (preprocessed) event log.
case_log (pd.DataFrame) – Dataframe containing only one row for each case.
dfr_list (list of tuple) – The Directly-Follows Relations for which the periodically aggregated DFR performances are computed. Should be formatted as follows: [(‘activity_string_1’, ‘activity_string_2’), …]. _description_
time_col (str) – The time column of interest in the event log. Determined in the plotting functions calling this util function.
numeric_agg (str) – How the DFRs assigned to each time bucket should be aggregated towards one aggregated measure.
- Returns:
period_dfr_perf (pd.DataFrame) – Dataframe with on the rows the chronologically ordered time buckets, and with each column being the aggregated DFR performances for one of of the DFRs listed in
dfr_list.perf_units_cols (list of string) – The most suitable time units are, for each requested DFR separately, determined automatically. This list contains these time units in the correct order, such that the appropriate time units can be displayed in the visualizations.
- DyLoPro.plotting_utils.get_features_df(log: DataFrame, column_list, case_id_key='case:concept:name', numEventFt_transform='last') DataFrame[source]
Given a dataframe and a list of columns, performs an automatic feature extraction.
Code of this function inspired by source code of PM4PY.
- Parameters:
log (pandas.DataFrame) – Event log.
column_list (list of str) – The column names (in ‘log’) for which the event features need to be elevated to the case level.
case_id_key (str, optional) – Column name (in ‘log’) that contains the case ID. By default ‘case:concept:name’.
numEventFt_transform ({'last', 'first', 'mean', 'median', 'sum', 'prod',) – ‘min’, ‘max’} If any numeric event features contained in
column_list,numEventFt_transformdetermines the way in which these numerical event features are transformed to the case level. By default ‘last’.
- Returns:
Feature dataframe (desidered output)
- Return type:
case_agg
- DyLoPro.plotting_utils.get_filtered_dfr_df(dfr_df, max_k=None, directly_follows_relations=None, counts=False)[source]
Return a pandas.DataFrame containing the DFR numbers together with a tuple containing the two corresponding activity labels of each DFR. Called by the get_DFR_df() method of the DynamicLogPlots class.
- Parameters:
dfr_df (pandas.DataFrame) – Dataframe containing a row for each DFR, with each row having two columns: ‘DFR’ and ‘DFR count’, containing the DFR tuple and amount of occurrences over the whole log respectively. The rows are arranged in descending order of ‘DFR count’. dfr_df can be obtained by means of the get_sorted_DFRs(log) function.
max_k (int, optional) – If specified, a dataframe containing the DFR numbers and their corresponding activity pairs for the max_k most frequently occurring DFRs is returned. By default None.
directly_follows_relations (list of tuple, optional) – List of tuples containing the specified DFRs. Each DFR needs to be specified as a tuple that contains 2 strings, referring to the 2 activities in the DFR, e.g. (‘activity_a’, ‘activity_b’). If specified and max_k=None, a dataframe containing the DFR numbers and corresponding activity pairs for each of the specified DFRs is returned. If max_k!=None, the DFRs specified here are ignored. By default None.
counts (bool, optional) – If counts=True, the ‘DFR count’ column that contains the number of occurrences of each DFR over the whole event log is included in the returned dataframe.
- Returns:
filtered_df_df – Dataframe containing ‘DFR number’ index and the ‘DFR’ column containing for each requested DFR the encoded DFR index and the DFR tuple containing the corresponding activity pair respectively. If counts=True, the ‘DFR count’ column that contains the number of occurrences of each DFR over the whole event log is included too.
- Return type:
pandas.DataFrame
- DyLoPro.plotting_utils.get_filtered_var_df(variant_df, max_k, variants, counts)[source]
Get a pandas.DataFrame containing the variant numbers together with a tuple containing the activity label strings of each variant.
- Parameters:
var_df (pandas.DataFrame) – Dataframe containing a row for each variant, with each row having two columns: ‘variant’ and ‘variant count’, containing the variant tuple and amount of occurrences over the whole log respectively. The rows are arranged in descending order of ‘variant count’.
max_k (int, optional) – If specified, a dataframe containing the encoded variant numbers and corresponding tuple of N strings (with N the number of activities of a variant) is returned for each of the max_k most frequently occurring variants. By default None.
variants (list of tuple) – The variants for which the requested time series will be plotted. Each variant needs to be specified as a tuple that contains N strings, referring to the N activities that constitute that variant. If specified and max_k=None, a dataframe containing the encoded variant numbers and corresponding tuple of N strings for each of the specified DFRs is returned. If max_k!=None, the variants parameter is ignored. By default None.
counts (bool, optional) – If counts=True, the ‘variant count’ column that contains the number of occurrences of each variant over the whole event log is included in the returned dataframe.
- Returns:
filtered_var_df – Dataframe containing ‘variant number’ index and the ‘variant’ column containing for each requested variant the encoded variant index and the variant tuple containing the corresponding activity pair respectively. If counts=True, the ‘variant count’ column that contains the number of occurrences of each variant over the whole event log is included too.
- Return type:
pandas.DataFrame
- DyLoPro.plotting_utils.get_maxrange(agg_df)[source]
Compute for each of the given arrays / pd.Series the maximum value that should not be considered as an extreme outlier (i.e. < q3 + 3 x iqr).
- Parameters:
agg_df (pd.DatFrame) – Shape (num periods, num series), with num periods being the amount of time buckets, and num series being the amount of time series for which outliers should be accounted for.
- Returns:
max_values – The ‘num series’ maximum values not to be considered as extreme outliers.
- Return type:
np.ndarray
- DyLoPro.plotting_utils.get_newVar_cases(log, time_col)[source]
Determines for each consecutive time period / time bucket the cases pertaining to variants that were first observed in that time period.
Only called by the
distinct_variants_AdvancedEvol()plotting method.- Parameters:
log (pd.DataFrame) – Event log that is already enhanced, prior to this function being called, with an additional ‘variant’ column containing the variant of each case.
time_col (str) – The time column of interest in the event log. Determined in the plotting functions calling this util function.
- Returns:
log (pd.DataFrame) – Event log containing additional column ‘variant_str’.
periodic_newvars (pd.DataFrame) – Contains two columns, the chronologically ordered unique periodic timestamps / time buckets, and a tuple of mapped variant strings in the second column containing the variants that were first observed in the corresponding time bucket.
- DyLoPro.plotting_utils.get_ordered_variantMap(case_log, time_col)[source]
Computes a variant mapping that maps the tuple representation of a variant to a unique string. The mapping is ordered. Only used by the
get_neVar_cases()util function in this same module.- Parameters:
case_log (pd.DataFrame) – Event log containing only one row for each case. Already enhanced with a column that contains the variant of that case.
time_col (str) – Column name specifying the relevant time bucket each case should be assigned to.
- Returns:
case_log (pd.DataFrame) – case_log containing an additional column ‘variant_str’.
periodic_newvars (pd.DataFrame) – Contains two columns, the chronologically ordered unique periodic timestamps / time buckets, and a tuple of mapped variant strings in the second column containing the variants that were first observed in the corresponding time bucket.
- DyLoPro.plotting_utils.get_outcome_percentage(filtered_log, outcome, time_col)[source]
Compute for each time bucket the fraction of cases with
outcome=1for the cases infiltered_log.- Parameters:
filtered_log (pd.DataFrame) – FIltered event log. The case filtering is performed by the plotting functions calling this util function, and depends on the purpose and arguments of these plotting functions.
outcome (str) – Name of the outcome column in
filtered_log.time_col (str) – The time column of interest in the event log. Determined in the plotting functions calling this util function.
- Returns:
Periodic fraction of cases with
outcome=1.- Return type:
pd.DataFrame
- DyLoPro.plotting_utils.get_sorted_DFRs(log)[source]
Retrieve all the Directly-Follows Relations (DFRs) in the log, sort them from highest to lowest frequency, and return them as a list of tuples. E.g. [(‘act_1_dfr_1’, ‘act_2_dfr_1’), (‘act_1_dfr_2’, ‘act_2_dfr_2’), …].
- Parameters:
log (pd.DataFrame) – The event log.
- Returns:
list_dfr – Sorted list of DFRs (in descending order of frequency).
- Return type:
str of tuple
- DyLoPro.plotting_utils.get_tt_ratios(log, num_fts_list, time_col, numeric_agg)[source]
Compute the periodic ratio of throughput time over numerical feature and automatically determine the most appropriate time unit for that ratio for each of the numerical features in
num_fts_listsimultaneously.- Parameters:
log (pd.DataFrame) – The event log.
num_fts_list (list of str) – Column names of numeric features of interest.
time_col (str) – The time column of interest in the event log. Determined in the plotting functions calling this util function.
numeric_agg (str) – How the ratios assigned to each time bucket should be aggregated towards one aggregated measure.
- Returns:
period_ttr (pd.DataFrame) – Periodically aggregated TT ratios for each of the numeric features given in num_fts_list.
perf_units_cols (list of str) – Indicating the automatically determined time unit for each of the requested numeric features.
- DyLoPro.plotting_utils.get_uniq_varcounts(log, time_col)[source]
Compute the number of distinct variants in each consecutive time bucket, as well as the number of distinct previously unseen variants in each time bucket.
- Parameters:
log (pd.DataFrame) – Event log that is already enhanced, prior to this function being called, with an additional ‘variant’ column containing the variant of each case.
time_col (str) – The time column of interest in the event log. Determined in the plotting functions calling this util function.
- Returns:
periodic_varcounts – Containing the chronologically ordered time buckets as the indices, and two columns, containing for each time bucket the number of distinct variants, and the number of distinct variants not seen in any of the preceding periods, respectively.
- Return type:
pd.DataFrame
- DyLoPro.plotting_utils.get_variant_case(log)[source]
Return a pd.Dataframe with a row row for each case, containing the unique case ID and the corresponding variant (as a tuple) in its columns.
- Parameters:
log (pd.DataFrame) – The event log.
- Returns:
case_variant – Dataframe with one row for each case and two columns, ‘case:concept:name’ and ‘variant’.
- Return type:
pd.DataFrame
- DyLoPro.plotting_utils.select_number_column(log, case_agg, col, numEventFt_transform, case_id_key='case:concept:name') DataFrame[source]
Extract a column for the features dataframe for the given numeric attribute.
Code of this function inspired by source code of PM4PY.
- Parameters:
log (pandas.DataFrame) – Event log.
case_agg – Feature dataframe.
col – Numeric column.
numEventFt_transform ({'last', 'first', 'mean', 'median', 'sum', 'prod',) – ‘min’, ‘max’} Determines the way in which these numerical event features are transformed to the case level. By default ‘last’.
case_id_key – Case ID key
- Returns:
Feature dataframe (desidered output)
- Return type:
case_agg
- DyLoPro.plotting_utils.select_string_column(log, case_agg, col, case_id_key='case:concept:name')[source]
Extract N columns (for N different attribute values; hotencoding) for the features dataframe for the given string attribute.
Code of this function inspired by source code of PM4PY.
- Parameters:
log – Dataframe
case_agg – Feature dataframe
col – String column
case_id_key – Case ID key
- Returns:
Feature dataframe (desidered output)
- Return type:
case_agg
DyLoPro.preprocess_utils module
- DyLoPro.preprocess_utils.add_case_duration(log)[source]
- Parameters:
log (-) – complete pd.DataFrame
- Returns:
- pd.DataFrame enhanced with throughput time columns that indicate the case duration. The added columns are:
’tt_microseconds’, ‘tt_milliseconds’, ‘tt_seconds’, ‘tt_minutes’, ‘tt_hours’, ‘tt_days’ and ‘tt_weeks’
- Return type:
log
- DyLoPro.preprocess_utils.add_num_events(log)[source]
- Parameters:
log (-) – complete pd.DataFrame
- Returns:
pd.DataFrame enhanced with the ‘num_events’ column, indicating for each case how many events a case has.
- Return type:
log
- DyLoPro.preprocess_utils.add_periodic_timestamps(log)[source]
Preprocesses the event log by adding periodic timestamps for each possible case grouping.
The case grouping determines how each case is assigned to a certain time period. This is jointly determined by both the ‘frequency’ and ‘case_assignment’ argument present in each plotting method of the ‘DynamicLogPlots’ class. A case feature column is added for each (‘frequency’, ‘case_assignment’) combination.
- Parameters:
log (pandas.DataFrame) – Current version of the event log.
- Returns:
The log enhanced with multiple columns.
- Return type:
pandas.DataFrame
- DyLoPro.preprocess_utils.order_events(log)[source]
Verifies whether for each case, the events (rows) are arranged in the ascending order of the timestamps. If not, a warning is issued. The correct ordering is automatically done.
- DyLoPro.preprocess_utils.select_timerange(log, start_date, end_date)[source]
Select only those cases starting after start_date, and ending before end_date.
- Parameters:
log (pd.DataFrame) – The event log.
start_date (str) – Start date as a string. Format “dd/mm/YYYY”.
end_date (str) – End date as a string. Format “dd/mm/YYYY”.
- Returns:
log – The event log filtered based on the given time range.
- Return type:
pd.DataFrame
DyLoPro.univariate_plots module
- DyLoPro.univariate_plots.dfr_evol(log, directly_follows_relations, outcome=None, time_unit='days', frequency='weekly', case_assignment='first_event', type='univariate', numeric_agg='mean', xtr_outlier_rem=True)[source]
Computes and visualizes the time series requested by the identically named DynamicLogPlots instance.
- Parameters:
log (pandas.DataFrame) – Event log
directly_follows_relations (list of tuple) – The DFRs for which the requested time series will be plotted. Each DFR needs to be specified as a tuple that contains 2 strings, referring to the 2 activities in the DFR, e.g. (‘activity_a’, ‘activity_b’).
outcome (str, optional) – Name outcome column in log, by default None
time_unit ({'microseconds', 'milliseconds', 'seconds', 'minutes', 'hours', 'days', 'weeks'}) – Time unit in which the throughput time of cases is specified, by default ‘days’.
frequency ({'minutely', '5-minutely', '10-minutely', 'half-hourly', 'hourly' '2-hourly',) – ‘12-hourly’, ‘daily’, ‘weekly’, ‘2-weekly’, ‘monthly’, ‘quarterly’, ‘half-yearly’} Frequency by which the observations are grouped together, by default ‘weekly’.
case_assignment ({'first_event', 'last_event', 'max_events'}) – Determines the condition upon which each case is assigned to a certain period, by default ‘first_event’.
type ({'univariate', 'type_tt', 'type_events_case', 'type_outcome', 'type_dfr_performance'}) – Determines which time series are constructed and visualized, by default ‘univariate’. For a more detailed explanation of the different ‘type’ options, see Notes.
numeric_agg ({'mean', 'median', 'min', 'max', 'std'}) – Determines how periodic quantities are aggregated, by default ‘mean’.
xtr_outlier_rem (bool, optional) – If True, the vertical ranges of the plots are only determined by regular values, i.e. extreme outliers (>q3 + 3*iqr) in the time series are neglected when determining the vertical range, by default True.
Notes
For a more detailed explanation, see the documentation of the identically named DynamicLogPlots class method.
- DyLoPro.univariate_plots.distinct_variants_AdvancedEvol(log, outcome=None, time_unit='days', frequency='weekly', case_assignment='first_event', type='univariate', numeric_agg='mean', xtr_outlier_rem=True, cases_initialized=True)[source]
Computes and visualizes the time series requested by the identically named DynamicLogPlots instance.
- Parameters:
log (pandas.DataFrame) – Event log
outcome (str, optional) – Name outcome column in log, by default None
time_unit ({'microseconds', 'milliseconds', 'seconds', 'minutes', 'hours', 'days', 'weeks'}) – Time unit in which the throughput time of cases is specified, by default ‘days’.
frequency ({'minutely', '5-minutely', '10-minutely', 'half-hourly', 'hourly' '2-hourly',) – ‘12-hourly’, ‘daily’, ‘weekly’, ‘2-weekly’, ‘monthly’, ‘quarterly’, ‘half-yearly’} Frequency by which the observations are grouped together, by default ‘weekly’.
case_assignment ({'first_event', 'last_event', 'max_events'}) – Determines the condition upon which each case is assigned to a certain period, by default ‘first_event’.
type ({'univariate', 'type_tt', 'type_events_case', 'type_outcome'}) – Determines which time series are constructed and visualized, by default ‘univariate’. For a more detailed explanation of the different ‘type’ options, see Notes.
numeric_agg ({'mean', 'median', 'min', 'max', 'std'}) – Determines how periodic quantities are aggregated, by default ‘mean’.
xtr_outlier_rem (bool, optional) – If True, the vertical ranges of the plots are only determined by regular values, i.e. extreme outliers (>q3 + 3*iqr) in the time series are neglected when determining the vertical range, by default True.
cases_initialized (bool, optional) – _description_, by default True
Notes
For a more detailed explanation, see the documentation of the identically named DynamicLogPlots class method.
- DyLoPro.univariate_plots.distinct_variants_evol(log, outcome=None, time_unit='days', frequency='weekly', case_assignment='first_event', type='univariate', numeric_agg='mean', xtr_outlier_rem=True, cases_initialized=True)[source]
Computes and visualizes the time series requested by the identically named DynamicLogPlots instance.
- Parameters:
log (pandas.DataFrame) – Event log
outcome (str, optional) – Name outcome column in log, by default None
time_unit ({'microseconds', 'milliseconds', 'seconds', 'minutes', 'hours', 'days', 'weeks'}) – Time unit in which the throughput time of cases is specified, by default ‘days’.
frequency ({'minutely', '5-minutely', '10-minutely', 'half-hourly', 'hourly' '2-hourly',) – ‘12-hourly’, ‘daily’, ‘weekly’, ‘2-weekly’, ‘monthly’, ‘quarterly’, ‘half-yearly’} Frequency by which the observations are grouped together, by default ‘weekly’.
case_assignment ({'first_event', 'last_event', 'max_events'}) – Determines the condition upon which each case is assigned to a certain period, by default ‘first_event’.
type ({'univariate', 'type_tt', 'type_events_case', 'type_outcome'}) – Determines which time series are constructed and visualized, by default ‘univariate’. For a more detailed explanation of the different ‘type’ options, see Notes.
numeric_agg ({'mean', 'median', 'min', 'max', 'std'}) – Determines how periodic quantities are aggregated, by default ‘mean’.
xtr_outlier_rem (bool, optional) – If True, the vertical ranges of the plots are only determined by regular values, i.e. extreme outliers (>q3 + 3*iqr) in the time series are neglected when determining the vertical range, by default True.
cases_initialized (bool, optional) – _description_, by default True
Notes
For a more detailed explanation, see the documentation of the identically named DynamicLogPlots class method.
- DyLoPro.univariate_plots.num_casefts_evol(log, numeric_case_list, outcome=None, time_unit='days', frequency='weekly', case_assignment='first_event', type='univariate', numeric_agg='mean', xtr_outlier_rem=True)[source]
Computes and visualizes the time series requested by the identically named DynamicLogPlots instance.
- Parameters:
log (pandas.DataFrame) – Event log
numeric_case_list (list of str) – Column names of the numerical case features.
outcome (str, optional) – Name outcome column in log, by default None
time_unit ({'microseconds', 'milliseconds', 'seconds', 'minutes', 'hours', 'days', 'weeks'}) – Time unit in which the throughput time of cases is specified, by default ‘days’.
frequency ({'minutely', '5-minutely', '10-minutely', 'half-hourly', 'hourly' '2-hourly',) – ‘12-hourly’, ‘daily’, ‘weekly’, ‘2-weekly’, ‘monthly’, ‘quarterly’, ‘half-yearly’} Frequency by which the observations are grouped together, by default ‘weekly’.
case_assignment ({'first_event', 'last_event', 'max_events'}) – Determines the condition upon which each case is assigned to a certain period, by default ‘first_event’.
type ({'univariate', 'type_tt', 'type_events_case', 'type_outcome'}) – Determines which time series are constructed and visualized, by default ‘univariate’. For a more detailed explanation of the different ‘type’ options, see Notes.
numeric_agg ({'mean', 'median', 'min', 'max', 'std'}) – Determines how periodic quantities are aggregated, by default ‘mean’.
xtr_outlier_rem (bool, optional) – If True, the vertical ranges of the plots are only determined by regular values, i.e. extreme outliers (>q3 + 3*iqr) in the time series are neglected when determining the vertical range, by default True.
Notes
For a more detailed explanation, see the documentation of the identically named DynamicLogPlots class method.
- DyLoPro.univariate_plots.num_eventfts_evol(log, numeric_event_list, outcome=None, time_unit='days', frequency='weekly', case_assignment='first_event', type='univariate', numeric_agg='mean', xtr_outlier_rem=True, numEventFt_transform='last')[source]
Computes and visualizes the time series requested by the identically named DynamicLogPlots instance.
- Parameters:
log (pandas.DataFrame) – Event log
numeric_event_list (list of str) – Column names of the numerical event features.
outcome (str, optional) – Name outcome column in log, by default None
time_unit ({'microseconds', 'milliseconds', 'seconds', 'minutes', 'hours', 'days', 'weeks'}) – Time unit in which the throughput time of cases is specified, by default ‘days’.
frequency ({'minutely', '5-minutely', '10-minutely', 'half-hourly', 'hourly' '2-hourly',) – ‘12-hourly’, ‘daily’, ‘weekly’, ‘2-weekly’, ‘monthly’, ‘quarterly’, ‘half-yearly’} Frequency by which the observations are grouped together, by default ‘weekly’.
case_assignment ({'first_event', 'last_event', 'max_events'}) – Determines the condition upon which each case is assigned to a certain period, by default ‘first_event’.
type ({'univariate', 'type_tt', 'type_events_case', 'type_outcome'}) – Determines which time series are constructed and visualized, by default ‘univariate’. For a more detailed explanation of the different ‘type’ options, see Notes.
numeric_agg ({'mean', 'median', 'min', 'max', 'std'}) – Determines how periodic quantities are aggregated, by default ‘mean’.
xtr_outlier_rem (bool, optional) – If True, the vertical ranges of the plots are only determined by regular values, i.e. extreme outliers (>q3 + 3*iqr) in the time series are neglected when determining the vertical range, by default True.
numEventFt_transform ({'last', 'first', 'mean', 'median', 'sum', 'prod', 'min', 'max'}) – If any numeric event features contained in ‘event_features’, ‘numEventFt_transform’ determines the way in which these numerical event features are transformed to the case level. By default ‘last’.
Notes
For a more detailed explanation, see the documentation of the identically named DynamicLogPlots class method.
- DyLoPro.univariate_plots.topK_categorical_caseftr_evol(log, case_feature, outcome=None, time_unit='days', frequency='weekly', case_assignment='first_event', type='univariate', numeric_agg='mean', max_k=10, xtr_outlier_rem=True)[source]
Computes and visualizes the time series requested by the identically named DynamicLogPlots instance.
- Parameters:
log (pandas.DataFrame) – Event log
case_feature (str) – Column name of the categorical case feature.
outcome (str, optional) – Name outcome column in log, by default None
time_unit ({'microseconds', 'milliseconds', 'seconds', 'minutes', 'hours', 'days', 'weeks'}) – Time unit in which the throughput time of cases is specified, by default ‘days’.
frequency ({'minutely', '5-minutely', '10-minutely', 'half-hourly', 'hourly' '2-hourly',) – ‘12-hourly’, ‘daily’, ‘weekly’, ‘2-weekly’, ‘monthly’, ‘quarterly’, ‘half-yearly’} Frequency by which the observations are grouped together, by default ‘weekly’.
case_assignment ({'first_event', 'last_event', 'max_events'}) – Determines the condition upon which each case is assigned to a certain period, by default ‘first_event’.
type ({'univariate', 'type_tt', 'type_events_case', 'type_outcome'}) – Determines which time series are constructed and visualized, by default ‘univariate’. For a more detailed explanation of the different ‘type’ options, see Notes.
numeric_agg ({'mean', 'median', 'min', 'max', 'std'}) – Determines how periodic quantities are aggregated, by default ‘mean’.
max_k (int, optional) – Only the ‘max_k’ most frequently occurring levels of the feature are considered, by default 10.
xtr_outlier_rem (bool, optional) – If True, the vertical ranges of the plots are only determined by regular values, i.e. extreme outliers (>q3 + 3*iqr) in the time series are neglected when determining the vertical range, by default True.
Notes
For a more detailed explanation, see the documentation of the identically named DynamicLogPlots class method.
- DyLoPro.univariate_plots.topK_categorical_eventftr_evol(log, event_feature, outcome=None, time_unit='days', frequency='weekly', case_assignment='first_event', plt_type='univariate', numeric_agg='mean', max_k=10, xtr_outlier_rem=True)[source]
Computes and visualizes the time series requested by the identically named DynamicLogPlots instance.
- Parameters:
log (pandas.DataFrame) – Event log
event_feature (str) – Column name of the categorical event feature.
outcome (str, optional) – Name outcome column in log, by default None
time_unit ({'microseconds', 'milliseconds', 'seconds', 'minutes', 'hours', 'days', 'weeks'}) – Time unit in which the throughput time of cases is specified, by default ‘days’.
frequency ({'minutely', '5-minutely', '10-minutely', 'half-hourly', 'hourly' '2-hourly',) – ‘12-hourly’, ‘daily’, ‘weekly’, ‘2-weekly’, ‘monthly’, ‘quarterly’, ‘half-yearly’} Frequency by which the observations are grouped together, by default ‘weekly’.
case_assignment ({'first_event', 'last_event', 'max_events'}) – Determines the condition upon which each case is assigned to a certain period, by default ‘first_event’.
plt_type ({'univariate', 'type_tt', 'type_events_case', 'type_outcome'}) – Determines which time series are constructed and visualized, by default ‘univariate’. For a more detailed explanation of the different ‘plt_type’ options, see Notes.
numeric_agg (str, optional) – _description_, by default ‘mean’
max_k (int, optional) – Only the ‘max_k’ most frequently occurring levels of the feature are considered, by default 10.
xtr_outlier_rem (bool, optional) – If True, the vertical ranges of the plots are only determined by regular values, i.e. extreme outliers (>q3 + 3*iqr) in the time series are neglected when determining the vertical range, by default True.
Notes
For a more detailed explanation, see the documentation of the identically named DynamicLogPlots class method.
- DyLoPro.univariate_plots.topK_dfr_evol(log, top_k_dfr, outcome=None, time_unit='days', frequency='weekly', case_assignment='first_event', type='univariate', numeric_agg='mean', max_k=10, xtr_outlier_rem=True)[source]
Computes and visualizes the time series requested by the identically named DynamicLogPlots instance.
- Parameters:
log (pandas.DataFrame) – Event log
top_k_dfr (list of tuple) – The max_k most frequently occurring Directly-Follows Relations (DFRs).
outcome (str, optional) – Name outcome column in log, by default None
time_unit ({'microseconds', 'milliseconds', 'seconds', 'minutes', 'hours', 'days', 'weeks'}) – Time unit in which the throughput time of cases is specified, by default ‘days’.
frequency ({'minutely', '5-minutely', '10-minutely', 'half-hourly', 'hourly' '2-hourly',) – ‘12-hourly’, ‘daily’, ‘weekly’, ‘2-weekly’, ‘monthly’, ‘quarterly’, ‘half-yearly’} Frequency by which the observations are grouped together, by default ‘weekly’.
case_assignment ({'first_event', 'last_event', 'max_events'}) – Determines the condition upon which each case is assigned to a certain period, by default ‘first_event’.
type ({'univariate', 'type_tt', 'type_events_case', 'type_outcome', 'type_dfr_performance'}) – Determines which time series are constructed and visualized, by default ‘univariate’. For a more detailed explanation of the different ‘type’ options, see Notes.
numeric_agg ({'mean', 'median', 'min', 'max', 'std'}) – Determines how periodic quantities are aggregated, by default ‘mean’.
max_k (int, optional) – Only the ‘max_k’ most frequently occurring DFRs are considered, by default 10.
xtr_outlier_rem (bool, optional) – If True, the vertical ranges of the plots are only determined by regular values, i.e. extreme outliers (>q3 + 3*iqr) in the time series are neglected when determining the vertical range, by default True.
Notes
For a more detailed explanation, see the documentation of the identically named DynamicLogPlots class method.
- DyLoPro.univariate_plots.topK_variants_evol(log, top_k_vars, outcome=None, time_unit='days', frequency='weekly', case_assignment='first_event', type='univariate', numeric_agg='mean', max_k=10, xtr_outlier_rem=True)[source]
Computes and visualizes the time series requested by the identically named DynamicLogPlots instance.
- Parameters:
log (pandas.DataFrame) – Event log
top_k_vars (list of tuple) – The ‘max_k’ most frequently occurring variants.
outcome (str, optional) – Name outcome column in log, by default None
time_unit ({'microseconds', 'milliseconds', 'seconds', 'minutes', 'hours', 'days', 'weeks'}) – Time unit in which the throughput time of cases is specified, by default ‘days’.
frequency ({'minutely', '5-minutely', '10-minutely', 'half-hourly', 'hourly' '2-hourly',) – ‘12-hourly’, ‘daily’, ‘weekly’, ‘2-weekly’, ‘monthly’, ‘quarterly’, ‘half-yearly’} Frequency by which the observations are grouped together, by default ‘weekly’.
case_assignment ({'first_event', 'last_event', 'max_events'}) – Determines the condition upon which each case is assigned to a certain period, by default ‘first_event’.
type ({'univariate', 'type_tt', 'type_outcome'}) – Determines which time series are constructed and visualized, by default ‘univariate’. For a more detailed explanation of the different ‘type’ options, see Notes.
numeric_agg ({'mean', 'median', 'min', 'max', 'std'}) – Determines how periodic quantities are aggregated, by default ‘mean’.
max_k (int, optional) – Only the ‘max_k’ most frequently occurring variants are considered, by default 10.
xtr_outlier_rem (bool, optional) – If True, the vertical ranges of the plots are only determined by regular values, i.e. extreme outliers (>q3 + 3*iqr) in the time series are neglected when determining the vertical range, by default True.
Notes
For a more detailed explanation, see the documentation of the identically named DynamicLogPlots class method.
- DyLoPro.univariate_plots.variants_evol(log, variants, outcome=None, time_unit='days', frequency='weekly', case_assignment='first_event', type='univariate', numeric_agg='mean', xtr_outlier_rem=True)[source]
Computes and visualizes the time series requested by the identically named DynamicLogPlots instance.
- Parameters:
log (pandas.DataFrame) – Event log
variants (list of tuple) – The variants for which the requested time series will be plotted. Each variant needs to be specified as a tuple that contains N strings, referring to the N activities that constitute that variant.
outcome (str, optional) – Name outcome column in log, by default None
time_unit ({'microseconds', 'milliseconds', 'seconds', 'minutes', 'hours', 'days', 'weeks'}) – Time unit in which the throughput time of cases is specified, by default ‘days’.
frequency ({'minutely', '5-minutely', '10-minutely', 'half-hourly', 'hourly' '2-hourly',) – ‘12-hourly’, ‘daily’, ‘weekly’, ‘2-weekly’, ‘monthly’, ‘quarterly’, ‘half-yearly’} Frequency by which the observations are grouped together, by default ‘weekly’.
case_assignment ({'first_event', 'last_event', 'max_events'}) – Determines the condition upon which each case is assigned to a certain period, by default ‘first_event’.
type ({'univariate', 'type_tt', 'type_outcome'}) – Determines which time series are constructed and visualized, by default ‘univariate’. For a more detailed explanation of the different ‘type’ options, see Notes.
numeric_agg ({'mean', 'median', 'min', 'max', 'std'}) – Determines how periodic quantities are aggregated, by default ‘mean’.
xtr_outlier_rem (bool, optional) – If True, the vertical ranges of the plots are only determined by regular values, i.e. extreme outliers (>q3 + 3*iqr) in the time series are neglected when determining the vertical range, by default True.
Notes
For a more detailed explanation, see the documentation of the identically named DynamicLogPlots class method.
DyLoPro.validate_methods module
Module contents
Top-level package for DyLoPro. DyLoPro is a generic visual analytics framework that facilitates the comprehensive exploration of the dynamics in event logs over time. It caters to all kinds of event logs, and provides the means to explore the dynamics from all different perspectives, both individually as well as combined with the performance perspective. Consequently, also a multi-dimensional view on the dynamics in process performance can be adopted. The purpose of DyLoPro is to efficiently identify patterns, temporary or permanent changes and trends of interest from different perspectives, which upon identification could be further analyzed in a manner deemed appropriate by the user.