[FIX] Weighted mean computation in Orange.statistics.util.stats#6204
Merged
markotoplak merged 2 commits intobiolab:masterfrom Nov 18, 2022
Merged
[FIX] Weighted mean computation in Orange.statistics.util.stats#6204markotoplak merged 2 commits intobiolab:masterfrom
markotoplak merged 2 commits intobiolab:masterfrom
Conversation
Member
Author
|
The bug originates from 8a76580 by @nikicc. I nominate @pavlin-policar, who worked on similar code, to review this PR. :) |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #6204 +/- ##
=======================================
Coverage 86.65% 86.65%
=======================================
Files 316 316
Lines 67991 67997 +6
=======================================
+ Hits 58918 58924 +6
Misses 9073 9073 |
e01b122 to
9c69c4d
Compare
This was referenced Nov 16, 2022
Collaborator
|
This looks good to me. I've re-run the failing tests, but, in case they don't pass, can I just ignore them? The failures have nothing to do with this code here, and this looks ready to merge. |
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.
Issue
The tests added in the first commit of this PR fail. The new tests test a combination of unit (ones) weights and NaNs, which should give exactly the same results as unweighted samples. Well, they do not, because we have been sloppy: the current code also divided with non-used weights (corresponding to NaN data entries).
Description of changes
The
nanmeanfunction was easy to extend with weights. For sparse I just needed to add a parameter. For dense I did an extension. Now,statsusesnanmeaninternally.Includes