Improve stochastic universal selector#945
Merged
jenetics merged 1 commit intojenetics:releases/r8.3.0from May 22, 2025
nyckyta:master
Merged
Improve stochastic universal selector#945jenetics merged 1 commit intojenetics:releases/r8.3.0from nyckyta:master
jenetics merged 1 commit intojenetics:releases/r8.3.0from
nyckyta:master
Conversation
Owner
|
Hi @nyckyta, thank you for the fix. Do you mind to add also a unit-test, which will verify the fix? :) |
Contributor
Author
|
Sure. Give me few days, I will add some tests. |
There are multiple issues that appear in the current version of the implementation: 1. Unnecessary sorting is done before each selection. SUS does not require sorting, copy and sort look like wasting of resources, can be critical on algorithms requiring highly intensive computation. 2. Distance between points in SUS must be equally sized intervals. The previous version had random size interval between zero's and first points. 3. Actual selection of population from points and cumulative probability had a bug. Selection of i-th element has been done through analyzing (i-1)-th interval. Previously, the 0-th element has always been skipped. As a result first interval actually always corresponded to the second element creating a skew in distribution. For example, if we had probabilities == [0.7, 0.2, 0.1], and points == (0.33, 0.66, 0.99). It can be seen that these parameters will produce [1, 1, 1] population (values are indexes of parents from original populations). Obviously, it is wrong. It ia also worth to mention, that this fix shows better results on performance tests done for SUS. Previous versions did fail some of the tests. This version actually passes all performance tests.
Contributor
Author
|
@jenetics , done |
jenetics
added a commit
that referenced
this pull request
May 22, 2025
Signed-off-by: Franz Wilhelmstötter <franz.wilhelmstoetter@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There are multiple issues that appear in the current version of the implementation:
For example, if we had probabilities == [0.7, 0.2, 0.1], and points == (0.12, 0.45, 0.78). It can be seen that these parameters will produce [1, 1, 2] population (values are indexes of parents from original populations). Obviously, it is wrong.
It ia also worth to mention, that this fix shows better results on performance tests done for SUS. Previous versions did fail some of the tests. This version actually passes all performance tests.