pm4py.algo.discovery.dcr_discover.variants package#
Submodules#
pm4py.algo.discovery.dcr_discover.variants.dcr_discover module#
- class pm4py.algo.discovery.dcr_discover.variants.dcr_discover.Parameters(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
Bases:
Enum
An enumeration class to hold parameter keys used for specifying the activity and case identifier keys within a log during the DCR discovery process.
Attributes#
- ACTIVITY_KEYstr
The key used to identify the activity attribute in the event log.
- CASE_ID_KEYstr
The key used to identify the case identifier attribute in the event log.
- ACTIVITY_KEY = 'pm4py:param:activity_key'#
- CASE_ID_KEY = 'pm4py:param:case_id_key'#
- pm4py.algo.discovery.dcr_discover.variants.dcr_discover.apply(log, findAdditionalConditions=True, parameters=None) Tuple[DcrGraph, Dict[str, Any]] [source]#
Discovers a DCR graph model from an event log, using algorithm described in [1].
Parameters#
- log
event log (pandas dataframe)
- findAdditionalConditions
bool value to identify if additional conditions should be mined
- parameters
Possible parameters of the algorithm, including: - Parameters.ACTIVITY_KEY - Parameters.Case_ID_KEY
Returns#
- tuple(dict,dict)
returns tuple of dictionaries containing the dcr_graph and the abstracted log used to mine the graph
References#
- class pm4py.algo.discovery.dcr_discover.variants.dcr_discover.Discover[source]#
Bases:
object
The Discover class is responsible for mining DCR graphs from event logs.
Attributes#
- graphdict
A dictionary representing the DCR graph, initialized from a template.
- logAbstractiondict
A dictionary containing abstracted information from the event log to be mined.
Methods#
- mine(log: Union[EventLog, pd.DataFrame], findAdditionalConditions: bool = True, parameters: Optional[dict] = None) -> Tuple[DCR_Graph, Dict[str, Any]]:
Mines a DCR graph and the log abstraction from an event log.
- createLogAbstraction(log: Union[EventLog, pd.DataFrame], activity_key: str, case_key: str) -> int:
Creates an abstraction of the event log to facilitate the mining process.
- parseTrace(trace: List[str]) -> int:
Parses a single trace to extract relations between events.
- optimizeRelation(relation: Dict[str, Set[str]]) -> Dict[str, Set[str]]:
Optimizes a relation by removing redundant relations based on transitive closure.
- mineFromAbstraction(findAdditionalConditions: bool = True) -> int:
Mines DCR constraints from the log abstraction.
- mine(log: EventLog | DataFrame, findAdditionalConditions=True, parameters=None) Tuple[DcrGraph, Dict[str, Any]] [source]#
Method used for calling the underlying mining algorithm used for discovery of DCR Graphs
Parameters#
- log
an event log as EventLog or pandas.DataFrame
- findAdditionalConditions
Condition for mining additional condition: True (default) or False
- parameters
activity_key: optional parameter, used to identify the activities in the log case_id_key: optional parameter, used to identify the cases executed in the log
Returns#
- Tuple[DcrGraph,Dict[str, Any]]
returns a tuple containing: - The DCR Graph - The log abstraction used for mining
- createLogAbstraction(log: [<class 'pm4py.objects.log.obj.EventLog'>, <class 'pandas.core.frame.DataFrame'>], activity_key: str, case_key: str) int [source]#
Performs the mining of abstraction log, will map event log onto a selection of DECLARE templates.
Parameters#
- logEventLog | pd.DataFrame
The event log to be abstracted.
- activity_keystr
The attribute key used to identify the activities recorded in the log.
- case_keystr
The attribute key used to identify the cases recorded in the log.
Returns#
- int
Returns 0 for success, and any other value for failure.
- parseTrace(trace: List[str]) int [source]#
Parses a trace to mine DEClARE constraints.
Parameters#
- traceList[str]
A list representing a trace, where each element is an event, and the order of events is maintained.
Returns#
- int
Returns 0 on success, and any other value on failure.
Notes#
This method performs the following key steps: - Identifies and updates predecessor relationships for each event in the trace. - Updates ‘atMostOnce’, ‘precedenceFor’, and ‘chainPrecedenceFor’ sets in the log abstraction based on the trace events. - Computes and updates ‘responseTo’ sets in the log abstraction based on the events seen before and after each event in the trace.
- optimizeRelation(relation: Dict[str, Set[str]]) Dict[str, Set[str]] [source]#
Optimizes a given relation by removing redundant connections based on transitive closure.
For instance, if there are relations A -> B, B -> C, then an existing relation A -> C can be removed as it is implied by the transitive nature of the other relations.
Parameters#
- relationDict[str, Set[str]]
A dictionary representing a relation, where keys are starting points and values are sets of endpoints.
Returns#
- Dict[str, Set[str]]
An optimized version of the input relations, with redundant connections removed.
- mineFromAbstraction(findAdditionalConditions: bool = True) int [source]#
Mines DCR constraints based on the DECLARE templates stored in the log abstraction.
This method initializes a graph and mines conditions, responses, self-exclusions, and additional conditions (if specified) from the user. It also optimizes the relations by removing redundant relations based on transitive closure.
Parameters#
- findAdditionalConditionsbool, optional
Specifies whether to mine additional conditions. Default is True.
Returns#
- int
Returns 0 if successful, anything else for failure.