ahmedfgad / GeneticAlgorithmPython

Source code of PyGAD, a Python 3 library for building the genetic algorithm and training machine learning algorithms (Keras & PyTorch).
https://pygad.readthedocs.io
BSD 3-Clause "New" or "Revised" License
1.89k stars 464 forks source link

"reach" stop criteria with negative valued fitness function #296

Open Tropingenie opened 4 months ago

Tropingenie commented 4 months ago

I am getting a ValueError: The value following the stop word in the 'stop_criteria' parameter must be a number but the value (-0.5) of type <class 'str'> found when trying to input a stop criteria with negative valued fitness function stop_criteria=["saturate_10", "reach_-0.5"],. I am unable to find any documentation on how the criteria "groups" numbers, and would rather not have to trawl through the code myself to find out.

If this feature is supported it would be appreciated if someone could explain how, otherwise, potentially a future feature. Until then I can always use the multiplicative inverse instead, but it reduces the readability of my outputs ("0.5" is an exact dollar error in my code, "2" is the inverse and less useful on its own).