pm4py.algo.conformance.dcr.variants package#
Submodules#
pm4py.algo.conformance.dcr.variants.classic module#
- class pm4py.algo.conformance.dcr.variants.classic.Parameters(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
Bases:
Enum
- CASE_ID_KEY = 'pm4py:param:case_id_key'#
- ACTIVITY_KEY = 'pm4py:param:activity_key'#
- class pm4py.algo.conformance.dcr.variants.classic.Outputs(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
Bases:
Enum
- FITNESS = 'dev_fitness'#
- DEVIATIONS = 'deviations'#
- NO_DEV_TOTAL = 'no_dev_total'#
- NO_CONSTR_TOTAL = 'no_constr_total'#
- IS_FIT = 'is_fit'#
- class pm4py.algo.conformance.dcr.variants.classic.RuleBasedConformance(log: EventLog | DataFrame, graph: DcrGraph | DistributedDcrGraph, parameters: Dict[str | Any, Any] | None = None)[source]#
Bases:
object
The RoleBasedConformance class provides a simplified interface to perform Rule based conformance check for DCR graphs abstract the complexity of direct interaction with the underlying classes:
CheckConditions
CheckResponses
CheckExcludes
CheckIncludes
CheckRoles,
RuleBasedConformance is initialized, with the DCR graph to be analyzed, The event log to be replayed, Optional parameters can also be passed to customize the processing, such as specifying custom activity and case ID keys.
After initialization of RuleBasedConformance class, user can call apply_conformance(), where the DCR Graph will replay the provided event log. Once replay is done, returns a list of conformance results for each trace, such as fitness, and the deviations
Example usage:
Note: - The user is expected to have a base understanding of DCR Graphs and rule based conformance checking in context of process mining
- Attributes:
DCR Graph: The DCR graph to be checked Event log: The event log to be replayed Checker (HandleChecker): handler for the conformance checkers for each rule. Semantics (DcrSemantics()): The semantics used executing events from the event log Parameters: optinal parameters given by the user
- Methods:
apply_conformance(): performs the replay and computing of conformance of each trace
- apply_conformance() List[Dict[str, Any]] [source]#
Apply Rule based conformance against a DCR Graph, replays the event log using the DCR graph. A DCR Graph will before each execution, check for deviations if the current event to be executed is enabled or if DCR graph contains distributed, if events are executed by the correct distributed. Will for each replay of trace check if DCR graph is in an accepting state, if not it determines cause.
For each replay it computes the fitness of the trace.
Implementation based on the theory provided in [1].
Returns#
- return:
List containing dictionaries with the following keys and values: - no_constr_total: the total number of constraints of the DCR Graphs - deviations: the list of deviations - no_dev_total: the total number of deviations - dev_fitness: the fitness (1 - no_dev_total / no_constr_total), - is_fit: True if the case is perfectly fit
- rtype:
List[Dict[str, Any]]
References#
[1] C. Josep et al., “Conformance Checking Software”, Springer International Publishing, 65-74, 2018. DOI.
- class pm4py.algo.conformance.dcr.variants.classic.HandleChecker(graph: DcrGraph | DistributedDcrGraph)[source]#
Bases:
object
HandleChecker is responsible for the constructing and calling the associated conformance checker for the replay algorithm. This class provides the functionalities to check conformance, retrieves the underlying methods for rule checking deviations
The handle checker is provided the DCR graphs, to construct the collection of methods used for conformance checking
Attributes#
- Checker:
pm4py.algo.conformance.dcr.decorators.decorator.Checker
The Checker to be used to compute and determine deviations during replay
Methods#
- enabled_checker(event, graph, deviations, parameters) -> None:
Checks for deviations when an activity is not enabled in the DCR Graphs
- all_checker(event, event_attributes, graph, deviations, parameters) -> None:
Check for deviations that can happen when the rule is not dependent on events being enabled
- accepting_checker(graph, response_origin, deviations, parameters) -> None:
Checks for deviations that caused the DCR Graphs to be in an unaccepted State after replay
Parameters#
- graph: Union[DcrGraph, DistributedDcrGraph]
DCR graph
- enabled_checker(event: str, graph: DcrGraph | DistributedDcrGraph, deviations: List[Any], parameters: Dict[Any, Any] | None = None) None [source]#
Enabled checker called when event is not enabled for execution in trace Parameters ———- event: str
Current event in trace
- graph: Union[DcrGraph, DistributedDcrGraph]
DCR Graph
- deviations: List[Any]
List of deviations
- parameters: Optional[Dict[Any, Any]]
Optional parameters
- all_checker(event: str, event_attributes: Dict, graph: DcrGraph | DistributedDcrGraph, deviations: List[Any], parameters: Dict[Any, Any] | None = None) None [source]#
All checker called for each event in trace to check if any deviation happens regardless of being enabled
Parameters#
- event: str
Current event in trace
- event_attributes: Dict
All event information used for conformance checking
- graph: Union[DcrGraph, DistributedDcrGraph]
DCR Graph
- deviations: List[Any]
List of deviations
- parameters: Optional[Dict[Any, Any]]
Optional parameters
- accepting_checker(graph: DcrGraph | DistributedDcrGraph, response_origin: List[Tuple[str, str]], deviations: List[Any], parameters: Dict[Any, Any] | None = None) None [source]#
Accepting checker, called when the DCR graph at the end of trace execution is not not accepting
Parameters#
- graph: Union[DcrGraph, DistributedDcrGraph]
DCR Graph
response_origin deviations: List[Any]
List of deviations
- parameters: Optional[Dict[Any, Any]]
Optional parameters
- Checker:
- pm4py.algo.conformance.dcr.variants.classic.apply(log: DataFrame | EventLog, graph: DcrGraph | DistributedDcrGraph, parameters: Dict[Any, Any] | None = None)[source]#
Applies rule based conformance checking against a DCR graph and an event log. Replays the entire log, executing each event and store potential deviations based on set rules associated with the DCR graph.
Implementation based on the theory provided in [1].
Parameters#
- param log:
pd.DataFrame | EventLog event log as :class: EventLog or as pandas Dataframe
- param graph:
DCR_Graph | RoleDCR_Graph DCR Graph
- param parameters:
Optional[Dict[Any, Any]] Possible parameters of the algorithm, including:
Parameters.ACTIVITY_KEY => the attribute to be used as activity
Parameters.CASE_ID_KEY => the attribute to be used as case identifier
Parameters.GROUP_KEY => the attribute to be used as role identifier
Returns#
- return:
List containing dictionaries with the following keys and values: - no_constr_total: the total number of constraints of the DCR Graphs - deviations: the list of deviations - no_dev_total: the total number of deviations - dev_fitness: the fitness (1 - no_dev_total / no_constr_total), - is_fit: True if the case is perfectly fit
References#
- pm4py.algo.conformance.dcr.variants.classic.get_diagnostics_dataframe(log: EventLog | DataFrame, conf_result: List[Dict[str, Any]], parameters: Dict[Any, Any] | None = None) DataFrame [source]#
Gets the diagnostics dataframe from a log and the results of conformance checking of DCR graph
Applies the same functionality as log_skeleton and declare
Parameters#
- rtype:
DataFrame
- param log:
event log as :class: EventLog or as pandas Dataframe
- param conf_result:
Results of conformance checking
- param parameters:
Optional Parameter to specify case id key
Returns#
- return:
Diagnostics dataframe