Skip to content

Commit

Permalink
feat(pm4py): disable IM fallthroughs in the simplified interface
Browse files Browse the repository at this point in the history
  • Loading branch information
fit-alessandro-berti committed Sep 26, 2023
1 parent b456717 commit a7dc86f
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions pm4py/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ def discover_petri_net_alpha_plus(log: Union[EventLog, pd.DataFrame], activity_k
return alpha_miner.apply(log, variant=alpha_miner.Variants.ALPHA_VERSION_PLUS, parameters=get_properties(log, activity_key=activity_key, timestamp_key=timestamp_key, case_id_key=case_id_key))


def discover_petri_net_inductive(log: Union[EventLog, pd.DataFrame, DFG], multi_processing: bool = constants.ENABLE_MULTIPROCESSING_DEFAULT, noise_threshold: float = 0.0, activity_key: str = "concept:name", timestamp_key: str = "time:timestamp", case_id_key: str = "case:concept:name") -> Tuple[
def discover_petri_net_inductive(log: Union[EventLog, pd.DataFrame, DFG], multi_processing: bool = constants.ENABLE_MULTIPROCESSING_DEFAULT, noise_threshold: float = 0.0, activity_key: str = "concept:name", timestamp_key: str = "time:timestamp", case_id_key: str = "case:concept:name", disable_fallthroughs: bool = False) -> Tuple[
PetriNet, Marking, Marking]:
"""
Discovers a Petri net using the inductive miner algorithm.
Expand All @@ -290,6 +290,7 @@ def discover_petri_net_inductive(log: Union[EventLog, pd.DataFrame, DFG], multi_
:param activity_key: attribute to be used for the activity
:param timestamp_key: attribute to be used for the timestamp
:param case_id_key: attribute to be used as case identifier
:param disable_fallthroughs: disable the Inductive Miner fall-throughs
:rtype: ``Tuple[PetriNet, Marking, Marking]``
.. code-block:: python3
Expand All @@ -308,7 +309,7 @@ def discover_petri_net_inductive(log: Union[EventLog, pd.DataFrame, DFG], multi_
log, activity_key=activity_key, timestamp_key=timestamp_key, case_id_key=case_id_key)

pt = discover_process_tree_inductive(
log, noise_threshold, multi_processing=multi_processing, activity_key=activity_key, timestamp_key=timestamp_key, case_id_key=case_id_key)
log, noise_threshold, multi_processing=multi_processing, activity_key=activity_key, timestamp_key=timestamp_key, case_id_key=case_id_key, disable_fallthroughs=disable_fallthroughs)
from pm4py.convert import convert_to_petri_net
return convert_to_petri_net(pt)

Expand Down Expand Up @@ -357,7 +358,7 @@ def discover_petri_net_heuristics(log: Union[EventLog, pd.DataFrame], dependency
return heuristics_miner.apply(log, parameters=parameters)


def discover_process_tree_inductive(log: Union[EventLog, pd.DataFrame, DFG], noise_threshold: float = 0.0, multi_processing: bool = constants.ENABLE_MULTIPROCESSING_DEFAULT, activity_key: str = "concept:name", timestamp_key: str = "time:timestamp", case_id_key: str = "case:concept:name") -> ProcessTree:
def discover_process_tree_inductive(log: Union[EventLog, pd.DataFrame, DFG], noise_threshold: float = 0.0, multi_processing: bool = constants.ENABLE_MULTIPROCESSING_DEFAULT, activity_key: str = "concept:name", timestamp_key: str = "time:timestamp", case_id_key: str = "case:concept:name", disable_fallthroughs: bool = False) -> ProcessTree:
"""
Discovers a process tree using the inductive miner algorithm
Expand All @@ -371,6 +372,7 @@ def discover_process_tree_inductive(log: Union[EventLog, pd.DataFrame, DFG], noi
:param multi_processing: boolean that enables/disables multiprocessing in inductive miner
:param timestamp_key: attribute to be used for the timestamp
:param case_id_key: attribute to be used as case identifier
:param disable_fallthroughs: disable the Inductive Miner fall-throughs
:rtype: ``ProcessTree``
.. code-block:: python3
Expand All @@ -393,6 +395,7 @@ def discover_process_tree_inductive(log: Union[EventLog, pd.DataFrame, DFG], noi
log, activity_key=activity_key, timestamp_key=timestamp_key, case_id_key=case_id_key)
parameters["noise_threshold"] = noise_threshold
parameters["multiprocessing"] = multi_processing
parameters["disable_fallthroughs"] = disable_fallthroughs

variant = inductive_miner.Variants.IMf if noise_threshold > 0 else inductive_miner.Variants.IM

Expand Down Expand Up @@ -539,7 +542,7 @@ def discover_eventually_follows_graph(log: Union[EventLog, pd.DataFrame], activi
return get.apply(log, parameters=properties)


def discover_bpmn_inductive(log: Union[EventLog, pd.DataFrame, DFG], noise_threshold: float = 0.0, multi_processing: bool = constants.ENABLE_MULTIPROCESSING_DEFAULT, activity_key: str = "concept:name", timestamp_key: str = "time:timestamp", case_id_key: str = "case:concept:name") -> BPMN:
def discover_bpmn_inductive(log: Union[EventLog, pd.DataFrame, DFG], noise_threshold: float = 0.0, multi_processing: bool = constants.ENABLE_MULTIPROCESSING_DEFAULT, activity_key: str = "concept:name", timestamp_key: str = "time:timestamp", case_id_key: str = "case:concept:name", disable_fallthroughs: bool = False) -> BPMN:
"""
Discovers a BPMN using the Inductive Miner algorithm
Expand All @@ -553,6 +556,7 @@ def discover_bpmn_inductive(log: Union[EventLog, pd.DataFrame, DFG], noise_thres
:param activity_key: attribute to be used for the activity
:param timestamp_key: attribute to be used for the timestamp
:param case_id_key: attribute to be used as case identifier
:param disable_fallthroughs: disable the Inductive Miner fall-throughs
:rtype: ``BPMN``
.. code-block:: python3
Expand All @@ -571,7 +575,7 @@ def discover_bpmn_inductive(log: Union[EventLog, pd.DataFrame, DFG], noise_thres
log, activity_key=activity_key, timestamp_key=timestamp_key, case_id_key=case_id_key)

pt = discover_process_tree_inductive(
log, noise_threshold, multi_processing=multi_processing, activity_key=activity_key, timestamp_key=timestamp_key, case_id_key=case_id_key)
log, noise_threshold, multi_processing=multi_processing, activity_key=activity_key, timestamp_key=timestamp_key, case_id_key=case_id_key, disable_fallthroughs=disable_fallthroughs)
from pm4py.convert import convert_to_bpmn
return convert_to_bpmn(pt)

Expand Down

0 comments on commit a7dc86f

Please sign in to comment.