pm4py.algo.evaluation.replay_fitness.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.evaluation.replay_fitness.variants.alignment_based 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.evaluation.replay_fitness.variants.alignment_based.Parameters(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: Enum

ACTIVITY_KEY = 'pm4py:param:activity_key'#
ATTRIBUTE_KEY = 'pm4py:param:attribute_key'#
TOKEN_REPLAY_VARIANT = 'token_replay_variant'#
CLEANING_TOKEN_FLOOD = 'cleaning_token_flood'#
MULTIPROCESSING = 'multiprocessing'#
pm4py.algo.evaluation.replay_fitness.variants.alignment_based.evaluate(aligned_traces: List[Dict[str, Any]], parameters: Dict[str | Parameters, Any] | None = None) Dict[str, float][source]#

Transforms the alignment result to a simple dictionary including the percentage of fit traces and the average fitness

Parameters#

aligned_traces

Alignments calculated for the traces in the log

parameters

Possible parameters of the evaluation

Returns#

dictionary

Containing two keys (percFitTraces and averageFitness)

pm4py.algo.evaluation.replay_fitness.variants.alignment_based.apply(log: EventLog, petri_net: PetriNet, initial_marking: Marking, final_marking: Marking, align_variant=Variants.VERSION_STATE_EQUATION_A_STAR, parameters: Dict[str | Parameters, Any] | None = None) Dict[str, float][source]#

Evaluate fitness based on alignments

Parameters#

log

Event log

petri_net

Petri net

initial_marking

Initial marking

final_marking

Final marking

align_variant

Variants of the alignments to apply

parameters

Parameters of the algorithm

Returns#

dictionary

Containing two keys (percFitTraces and averageFitness)

pm4py.algo.evaluation.replay_fitness.variants.alignment_based.apply_trace(trace: Trace, petri_net: PetriNet, initial_marking: Marking, final_marking: Marking, best_worst: Any, activity_key: str) Dict[str, Any][source]#

Performs the basic alignment search, given a trace, a net and the costs of the “best of the worst”. The costs of the best of the worst allows us to deduce the fitness of the trace. We compute the fitness by means of 1 - alignment costs / best of worst costs (i.e. costs of 0 => fitness 1)

Parameters#

trace: list input trace, assumed to be a list of events (i.e. the code will use the activity key to get the attributes) petri_net: pm4py.objects.petri.net.PetriNet the Petri net to use in the alignment initial_marking: pm4py.objects.petri.net.Marking initial marking in the Petri net final_marking: pm4py.objects.petri.net.Marking final marking in the Petri net best_worst: cost of the best worst alignment of a trace (empty trace aligned to the model) activity_key: str (optional) key to use to identify the activity described by the events

Returns#

dictionary: dict with keys alignment, cost, visited_states, queued_states and traversed_arcs

pm4py.algo.evaluation.replay_fitness.variants.token_replay 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.evaluation.replay_fitness.variants.token_replay.Parameters(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: Enum

ACTIVITY_KEY = 'pm4py:param:activity_key'#
ATTRIBUTE_KEY = 'pm4py:param:attribute_key'#
CASE_ID_KEY = 'pm4py:param:case_id_key'#
TOKEN_REPLAY_VARIANT = 'token_replay_variant'#
CLEANING_TOKEN_FLOOD = 'cleaning_token_flood'#
MULTIPROCESSING = 'multiprocessing'#
SHOW_PROGRESS_BAR = 'show_progress_bar'#
pm4py.algo.evaluation.replay_fitness.variants.token_replay.evaluate(aligned_traces: List[Dict[str, Any]], parameters: Dict[str | Parameters, Any] | None = None) Dict[str, float][source]#

Gets a dictionary expressing fitness in a synthetic way from the list of boolean values saying if a trace in the log is fit, and the float values of fitness associated to each trace

Parameters#

aligned_traces

Result of the token-based replayer

parameters

Possible parameters of the evaluation

Returns#

dictionary

Containing two keys (percFitTraces and averageFitness)

pm4py.algo.evaluation.replay_fitness.variants.token_replay.apply(log: EventLog, petri_net: PetriNet, initial_marking: Marking, final_marking: Marking, parameters: Dict[str | Parameters, Any] | None = None) Dict[str, float][source]#

Apply token replay fitness evaluation

Parameters#

log

Trace log

petri_net

Petri net

initial_marking

Initial marking

final_marking

Final marking

parameters

Parameters

Returns#

dictionary

Containing two keys (percFitTraces and averageFitness)