[FIX] Fix Chi2 computation for variables with values with no instances#2031
Merged
astaric merged 1 commit intobiolab:masterfrom Feb 21, 2017
jerneju:ghissue-2020
Merged
[FIX] Fix Chi2 computation for variables with values with no instances#2031astaric merged 1 commit intobiolab:masterfrom jerneju:ghissue-2020
astaric merged 1 commit intobiolab:masterfrom
jerneju:ghissue-2020
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2031 +/- ##
==========================================
- Coverage 70.7% 69.69% -1.01%
==========================================
Files 343 343
Lines 54469 54478 +9
==========================================
- Hits 38510 37967 -543
- Misses 15959 16511 +552Continue to review full report at Codecov.
|
astaric
requested changes
Feb 20, 2017
Orange/widgets/visualize/owsieve.py
Outdated
| self.residuals = \ | ||
| (self.observed - self.expected) / np.sqrt(self.expected) | ||
| where_are_NaNs = np.isnan(self.residuals) | ||
| self.residuals[where_are_NaNs] = 0 |
Member
There was a problem hiding this comment.
| gh-2031 | ||
| Check if it can calculate chi square when there are no attributes which suppose to be. | ||
| """ | ||
| tempdir = tempfile.mkdtemp() |
Member
There was a problem hiding this comment.
Instead of creating files in code, you could either commit the file along the test, or even better create the table directly with something along the lines of:
a, b = Orange.data.DiscreteVariable("a", values=["y", "n"]), Orange.data.DiscreteVariable("b", values=["y", "n", "other"])
t = Orange.data.Table(Orange.data.Domain([a, b], list(zip("yynny", "ynyyn"))))
…which suppose to be Chi-squared test is nan when there are attributes which are not in the data. It is caused by division by zero because code does not calculate limits. It actually suppose to be 0. Check if there is NaN in the array and then change that value to 0. - [X] Code changes - [X] Tests - [ ] Documentation
astaric
approved these changes
Feb 21, 2017
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.
Chi-squared test is nan when there are attributes which are not in the data. It is caused by division by zero because code does not calculate limits. It actually suppose to be 0.