@@ -214,7 +214,6 @@ def counterfactual_expl(self, trace):
214
214
if self .minimal_solution :
215
215
self .adherent_trace = None
216
216
length_of_trace = len (trace )
217
- print (length_of_trace )
218
217
delta = 1 # Starting with an increment of 1
219
218
while not self .adherent_trace :
220
219
self .contradiction_by_length (length_of_trace )
@@ -363,12 +362,17 @@ def determine_conformance_rate(self, event_log, constraints=None):
363
362
return (len_log - non_conformant ) / len_log
364
363
365
364
def determine_fitness_rate (self , event_log , constraints = None ):
365
+ """
366
+ Determines the fitness rate of the event log based on given constraints.
367
+
368
+ :param event_log: The event log to analyze.
369
+ :param constraints: The constraints to check against the event log. If None, use self.constraints.
370
+ :return: The fitness rate as a float between 0 and 1.
371
+ """
366
372
if not self .constraints and not constraints :
367
373
return "The explainer have no constraints"
368
374
if constraints == None :
369
375
constraints = self .constraints
370
- if len (constraints ) == 0 :
371
- print ("hej" )
372
376
conformant = 0
373
377
for con in constraints :
374
378
for trace , count in event_log .log .items ():
@@ -377,6 +381,14 @@ def determine_fitness_rate(self, event_log, constraints=None):
377
381
return conformant / (len (event_log ) * len (constraints ))
378
382
379
383
def variant_ctrb_to_fitness (self , event_log , trace , constraints = None ):
384
+ """
385
+ Determines the contribution of a specific trace variant to the fitness of the event log.
386
+
387
+ :param event_log: The event log to analyze.
388
+ :param trace: The trace variant to calculate its contribution.
389
+ :param constraints: The constraints to check against the event log. If None, use self.constraints.
390
+ :return: The contribution of the trace variant to the fitness as a float.
391
+ """
380
392
if not self .constraints and not constraints :
381
393
return "The explainer have no constraints"
382
394
if not constraints :
@@ -445,6 +457,14 @@ def constraint_ctrb_to_conformance(self, log, constraints, index):
445
457
return sum (sub_ctrbs )
446
458
447
459
def constraint_ctrb_to_fitness (self , log , constraints , index ):
460
+ """
461
+ Determines the Shapley value-based contribution of a constraint to the overall conformance rate.
462
+
463
+ :param log: The event log, where keys are strings and values are counts of trace variants.
464
+ :param constraints: A list of constraints (regexp strings).
465
+ :param index: The index of the constraint in the constraints list.
466
+ :return: The contribution of the constraint to the overall conformance rate as a float.
467
+ """
448
468
if len (constraints ) < index :
449
469
raise Exception ("Constraint not in constraint list." )
450
470
if not self .constraints and not constraints :
0 commit comments