pm4py.algo.conformance.alignments.edit_distance.variants package#
PM4Py – A Process Mining Library for Python
Copyright (C) 2024 Process Intelligence Solutions UG (haftungsbeschränkt)
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see this software project’s root or visit <https://www.gnu.org/licenses/>.
Website: https://processintelligence.solutions Contact: info@processintelligence.solutions
Submodules#
pm4py.algo.conformance.alignments.edit_distance.variants.edit_distance module#
PM4Py – A Process Mining Library for Python
Copyright (C) 2024 Process Intelligence Solutions UG (haftungsbeschränkt)
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see this software project’s root or visit <https://www.gnu.org/licenses/>.
Website: https://processintelligence.solutions Contact: info@processintelligence.solutions
- class pm4py.algo.conformance.alignments.edit_distance.variants.edit_distance.Parameters(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
Bases:
Enum- PERFORM_ANTI_ALIGNMENT = 'perform_anti_alignment'#
- ACTIVITY_KEY = 'pm4py:param:activity_key'#
- TIMESTAMP_KEY = 'pm4py:param:timestamp_key'#
- pm4py.algo.conformance.alignments.edit_distance.variants.edit_distance.apply(log1: EventLog, log2: EventLog, parameters: Dict[str | Parameters, Any] | None = None) List[Dict[str, Any]][source]#
Aligns each trace of the first log against the second log, minimizing the edit distance
Parameters#
- log1
First log
- log2
Second log
- parameters
Parameters of the algorithm
Returns#
- aligned_traces
List that contains, for each trace of the first log, the corresponding alignment
- pm4py.algo.conformance.alignments.edit_distance.variants.edit_distance.align_trace(trace: Trace, list_encodings: List[str], set_encodings: Set[str], mapping: Dict[str, str], cache_align: Dict[Any, Any] | None = None, parameters: Dict[str | Parameters, Any] | None = None) Dict[str, Any][source]#
Aligns a trace against a list of traces, minimizing the edit distance
Parameters#
- trace
Trace
- list_encodings
List of encoded traces (the same as set_encodings, but as a list)
- set_encodings
Set of encoded traces (the same as list_encodings, but as a set), useful to quickly check if the provided trace is contained in the traces of the other log
- mapping
Mapping (of activities to characters)
- cache_align
Cache of the alignments
- parameters
Parameters of the algorithm
Returns#
- aligned_trace
Aligned trace
- pm4py.algo.conformance.alignments.edit_distance.variants.edit_distance.project_log_on_variant(log: EventLog | DataFrame, variant: List[str], parameters: Dict[str | Parameters, Any] | None = None) EventLog[source]#
Projects the traces of an event log to the specified variant, in order to assess the conformance of the different directly-follows relationships and their performance (as the timestamps are recorded). The result is a event log where each ‘projected’ trace can be replayed on the given variant. Each event of a ‘projected’ trace has the ‘@@is_conforming’ attribute set to: - True when the activity is mimicked by the original trace (sync move) - False when the activity is not reflected in the original trace (move-on-model) Move-on-log (activities of the trace that are not mimicked by the variant) are skipped altogether.
Minimum Viable Example:
import pm4py from pm4py.algo.conformance.alignments.edit_distance.variants import edit_distance
log = pm4py.read_xes(“tests/input_data/receipt.xes”, return_legacy_log_object=True) variant = (‘Confirmation of receipt’, ‘T02 Check confirmation of receipt’, ‘T04 Determine confirmation of receipt’,
‘T05 Print and send confirmation of receipt’, ‘T06 Determine necessity of stop advice’, ‘T10 Determine necessity to stop indication’)
projected_log = edit_distance.project_log_on_variant(log, variant) pm4py.write_xes(projected_log, “projected_log2.xes”)
Parameters#
- log
Event log
- variant
Considered variant
- parameters
- Parameters of the method, including:
Parameters.ACTIVITY_KEY => the attribute of the event log to be used as activity
Parameters.TIMESTAMP_KEY => the attribute of the event log to be used as timestamp
Returns#
- projected_log
Projected event log with the aforementioned features