pm4py.algo.discovery.alpha.variants package

Submodules

pm4py.algo.discovery.alpha.variants.classic module

This module implements the “classic” alpha miner [1]_. It converts the input event log, which should be a log, to the (well-known) directly follows abstraction. For example, when we have a trace of the form (control-flow perspective) <…a,b,…>, we observe the relation a>b, i.e. activity a precedes activity b. From the directly follows relations, the alpha relations parallelism (||), conflict (x) and causality (->) are deduced. These relations form the basics for finding the places in the net. Finally, a start and end place is added.

References
1

Wil M. P. van der Aalst et al., “Workflow Mining: Discovering Process Models from Event Logs”, IEEE Trans. Knowl. Data Eng., 16, 1128-1142, 2004. DOI.

class pm4py.algo.discovery.alpha.variants.classic.Parameters(value)[source]

Bases: enum.Enum

An enumeration.

ACTIVITY_KEY = 'pm4py:param:activity_key'
CASE_ID_KEY = 'case_id_glue'
START_TIMESTAMP_KEY = 'pm4py:param:start_timestamp_key'
TIMESTAMP_KEY = 'pm4py:param:timestamp_key'
pm4py.algo.discovery.alpha.variants.classic.apply(log, parameters=None)[source]

This method calls the “classic” alpha miner [1]_.

Parameters
  • log (pm4py.log.log.EventLog) – Event log to use in the alpha miner

  • parameters

    Parameters of the algorithm, including:
    activity_keystr, optional

    Key to use within events to identify the underlying activity. By deafult, the value ‘concept:name’ is used.

Returns

  • net (pm4py.entities.petri.petrinet.PetriNet) – A Petri net describing the event log that is provided as an input

  • initial marking (pm4py.models.net.Marking) – marking object representing the initial marking

  • final marking (pm4py.models.net.Marking) – marking object representing the final marking, not guaranteed that it is actually reachable!

References

1

Wil M. P. van der Aalst et al., “Workflow Mining: Discovering Process Models from Event Logs”, IEEE Trans. Knowl. Data Eng., 16, 1128-1142, 2004. DOI.

pm4py.algo.discovery.alpha.variants.classic.apply_dfg(dfg, parameters=None)[source]

Applying Alpha Miner starting from the knowledge of the Directly Follows graph, and of the start activities and end activities in the log inferred from the DFG

Parameters
  • dfg – Directly-Follows graph

  • parameters

    Parameters of the algorithm including:

    activity key -> name of the attribute that contains the activity

Returns

  • net (pm4py.entities.petri.petrinet.PetriNet) – A Petri net describing the event log that is provided as an input

  • initial marking (pm4py.models.net.Marking) – marking object representing the initial marking

  • final marking (pm4py.models.net.Marking) – marking object representing the final marking, not guaranteed that it is actually reachable!

pm4py.algo.discovery.alpha.variants.classic.apply_dfg_sa_ea(dfg, start_activities, end_activities, parameters=None)[source]

Applying Alpha Miner starting from the knowledge of the Directly Follows graph, and of the start activities and end activities in the log (possibly inferred from the DFG)

Parameters
  • dfg – Directly-Follows graph

  • start_activities – Start activities

  • end_activities – End activities

  • parameters

    Parameters of the algorithm including:

    activity key -> name of the attribute that contains the activity

Returns

  • net (pm4py.entities.petri.petrinet.PetriNet) – A Petri net describing the event log that is provided as an input

  • initial marking (pm4py.models.net.Marking) – marking object representing the initial marking

  • final marking (pm4py.models.net.Marking) – marking object representing the final marking, not guaranteed that it is actually reachable!

pm4py.algo.discovery.alpha.variants.plus module

class pm4py.algo.discovery.alpha.variants.plus.Parameters(value)[source]

Bases: enum.Enum

An enumeration.

ACTIVITY_KEY = 'pm4py:param:activity_key'
REMOVE_UNCONNECTED = 'remove_unconnected'
pm4py.algo.discovery.alpha.variants.plus.add_sink(net, end_activities, label_transition_dict)[source]

Adding sink pe

pm4py.algo.discovery.alpha.variants.plus.add_source(net, start_activities, label_transition_dict)[source]

Adding source pe

pm4py.algo.discovery.alpha.variants.plus.apply(trace_log, parameters=None)[source]

Apply the Alpha Algorithm to a given log

Parameters
  • trace_log – Log

  • parameters – Possible parameters of the algorithm

Returns

  • net – Petri net

  • im – Initial marking

  • fm – Final marking

pm4py.algo.discovery.alpha.variants.plus.get_relations(log)[source]

Applying the classic Alpha Algorithm

Parameters

log – Filtered log

Returns

  • causal – Causal relations

  • parallel – Parallel relations

  • follows – Follows relations

pm4py.algo.discovery.alpha.variants.plus.get_sharp_relation(follows, instance_one, instance_two)[source]

Returns true if sharp relations holds

Parameters
  • follows – Follows relations

  • instance_one – Instance one

  • instance_two – Instance two

Returns

Boolean (sharp relation holds?)

Return type

bool

pm4py.algo.discovery.alpha.variants.plus.get_sharp_relations_for_sets(follows, set_1, set_2)[source]

Returns sharp relations for sets

Parameters
  • follows – Follows relations

  • set_1 – First set to consider

  • set_2 – Second set to consider

Returns

Boolean (sharp relation holds?)

Return type

bool

pm4py.algo.discovery.alpha.variants.plus.postprocessing(net, initial_marking, final_marking, A, B, pairs, loop_one_list)[source]

Adding the filtered transitions to the Petri net

Parameters
  • loop_list – List of looped activities

  • classical_alpha_result – Result after applying the classic alpha algorithm to the filtered log

  • A – See Paper for definition

  • B – See Paper for definition

Returns

  • net – Petri net

  • im – Initial marking

  • fm – Final marking

pm4py.algo.discovery.alpha.variants.plus.preprocessing(log, parameters=None)[source]

Preprocessing step for the Aplha+ algorithm. Removing all transitions from the log with a loop of length one.

Parameters
  • log – Event log

  • parameters – Parameters of the algorithm

Returns

  • log – filtered log and a list of the filtered transitions

  • loop_one_list – Loop one list

  • A_filtered – Dictionary: activity before the loop-length-one activity

  • B_filtered – Dictionary: activity after the loop-length-one activity

  • loops_in_first_place – Loops in source place

  • loops_in_last_place – Loops in sink place

pm4py.algo.discovery.alpha.variants.plus.processing(log, causal, follows)[source]

Applying the Alpha Miner with the new relations

Parameters
  • log – Filtered log

  • causal – Pairs that have a causal relation (->)

  • follows – Pairs that have a follow relation (>)

Returns

  • net – Petri net

  • im – Initial marking

  • fm – Final marking

pm4py.algo.discovery.alpha.variants.plus.remove_final_hidden_if_possible(net, fm)[source]

Remove final hidden transition if possible

Parameters
  • net – Petri net

  • fm – Final marking

Returns

Petri net

Return type

net

pm4py.algo.discovery.alpha.variants.plus.remove_initial_hidden_if_possible(net, im)[source]

Remove initial hidden transition if possible

Parameters
  • net – Petri net

  • im – Initial marking

Returns

  • net – Petri net

  • im – Possibly different initial marking

pm4py.algo.discovery.alpha.variants.plus.remove_unconnected_transitions(net)[source]

Remove unconnected transitions if any

Parameters

net – Petri net

Returns

Petri net without unconnected transitions

Return type

net

Module contents