guacamol_baselines
guacamol_baselines copied to clipboard
Fix division by 0 issue when all scores are zero
In graph_ga/goal_directed_generation.py
the mating pool is selected through weighted random sampling, with the probability of a molecule being selected given by its score divided by the sum of all scores (sum_scores
).
https://github.com/BenevolentAI/guacamol_baselines/blob/44d24c53f3acf9266eb2fb06dbff909836549291/graph_ga/goal_directed_generation.py#L25-L42
If sum_scores == 0.0
we get a division by 0. This actually occurs during the Valsartan SMARTS benchmark when using random starting molecules due to its binary nature.