Skip to content

Employee: Make sure the estimated fitness is always between 0 and 1

Ewout ter Hoeven requested to merge fix-estimated-fitness-out-of-bounds into main

Even if an employee has an estimation error, the estimated fitness should be between 0 and 1. An solution can't be worse than 0% or better than 100%, even with some error.

This does however cause a relatively large amount of solutions to have a fitness of exactly 0 or 1. This could be improved by a better statistical error distribution/mechanism.

I validated that the estimated fitness now always was between 0 and 1 in the IndividualLocationPerception class:

    def recordFitnessEstimation(self, layer, fitness):
        self.estimatedFitness[layer] = fitness
        if not 0 <= fitness <= 1:
            raise ValueError(f"Fitness must be between 0 and 1, but is {fitness}")

The 36 experiments in the main.py module ran without error.

@wkolk if your happy with this fix you can merge this MR!

Merge request reports