pm4py.algo.evaluation.replay_fitness.variants.alignment_based module#
- class pm4py.algo.evaluation.replay_fitness.variants.alignment_based.Parameters(*values)[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:
Containing two keys (percFitTraces and averageFitness)
- Return type:
dictionary
- 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:
Containing two keys (percFitTraces and averageFitness)
- Return type:
dictionary
- 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 (
listinput 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.PetriNetthe Petri net to use in the alignment)initial_marking (
pm4py.objects.petri.net.Markinginitial marking in the Petri net)final_marking (
pm4py.objects.petri.net.Markingfinal 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
- Return type:
dict with keys alignment, cost, visited_states, queued_states and traversed_arcs