GA for NN incorrect
Closed this issue · 2 comments
"This problem is because the probability of selecting a parent was determined by:
mate_probs = pop_fitness / np.sum(pop_fitness)
This will result in low numbers if pop_fitness is close to 0 and high numbers if pop_fitness is far from zero regardless of sign. Lets say there are 2 people in population with fitness -0.1 (good) and -10 (bad). the mate_probs would be -0.1 / -10.1 = ~0.01 for the good person and -10 / -10.1 or ~0.99 for the bad person. This means we are more likely to mate people with poor fitness...bad! "(taken from a piazza post in a class by the person who found it)
It's corrected in this fork which has basically redesigned/refactored most of the library with additional functionality
https://github.com/hiive/mlrose
specifically in this file
https://github.com/hiive/mlrose/blob/master/mlrose/opt_probs/_opt_prob.py
Just to add on, this only occurs due to the negative sign when we are minimizing using GA. Maximizing with GA seems to work fine.