-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FIX] Feature statistics fixes #3480
[FIX] Feature statistics fixes #3480
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3480 +/- ##
==========================================
+ Coverage 83.55% 83.71% +0.15%
==========================================
Files 367 370 +3
Lines 65454 66299 +845
==========================================
+ Hits 54690 55499 +809
- Misses 10764 10800 +36 |
@@ -500,7 +500,7 @@ def data(self, index, role): | |||
if role == Qt.DisplayRole: | |||
if isinstance(attribute, DiscreteVariable): | |||
output = self._center[row] | |||
if not np.isnan(output): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about else
? Should output
be set to ""
in this case? np.nan
is properly handled below with if output==output: output = ""
, but this won't work if an attribute has no values and self._center[row]
is ... whatever it is in this case (probably 0
).
f851db7
to
5fcd067
Compare
I've removed the commit that handled discrete variables with no values since this should never happen. In the event that it does happen, the underlying issue should be fixed and patched up in this widget. |
I am not sure why this passes on travis, but fails on appveyor (maybe different versions of libraries?). |
I can reproduce appveyor's error on windows. test_owfeaturestatistics -> force_render_table -> FeatureStatisticsTableModel.data tries to get a string value of a DiscreteVariable that has an empty list of values (owfeaturestatistics.py, line 515). |
Yes, that's actually the problem. Building a |
We traced the problem to scipy's mode function. For an array of nans it should return nan. It does so in the latest version 1.2, but not in version 1.0 that's used by appveyor. |
Issue
values
Description of changes
DiscreteVariable.str_val
crashes if it has novalues
. This means that the problem may exist in other widgets as well. I thought about fixing thestr_val
implementation, but I don't really know what it should do in this case (implementation here). In both cases a string is returned, so it's not clear what to do here. Perhaps this was even left out by design, so I fixed the issue on the widget.self.send_data("Data", data)
toself.send_data(self.widget.Inputs.data, data)
.Includes