-
-
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] Correspondence: Prevent crashing when cont attr has one value #2149
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2149 +/- ##
==========================================
+ Coverage 67.78% 67.83% +0.05%
==========================================
Files 319 319
Lines 54940 54962 +22
==========================================
+ Hits 37240 37284 +44
+ Misses 17700 17678 -22 |
list(zip( | ||
["0", "0", "0"] | ||
))) | ||
self.send_signal("Data", table) |
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.
Cool trick. You will get the same results with list(zip("000"))
.
However, [('0',)]*3
or simply [(0,), (0,), (0,)]
or np.zeros((3, 1))
would be more reader-friendly.
self.component_x, self.component_y = 0, 1 | ||
self.component_x = 0 | ||
self.component_y = 1 if \ | ||
len(self.varlist[self.selected_var_indices[-1]].values) > 1 else 0 |
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.
You don't need len
here.
(I'd actually write self.component_y = bool(self.varlist[self.selected_var_indices[-1]].values)
, but basically just to annoy @astaric. :)
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.
He does need len, because he wants to check if it is >1 and not >0.
It is also harder to annoy @astaric, but the if ... else
is unnecessary, so:
self.component_y = len(self.varlist[self.selected_var_indices[-1]].values) > 1
or if someone is the strict type:
int(len(self.varlist[self.selected_var_indices[-1]].values) > 1)
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.
I still get strange behaviour and crashes when data has a variable with a single value.
I used titanic and feature constructor to add a constant discrete var.
@@ -350,6 +351,9 @@ def gsvd(M, Wu, Wv): | |||
F = numpy.c_[D_r] * U * D | |||
G = numpy.c_[D_c] * V.T * D | |||
|
|||
if F.shape == (1, 1) and F == numpy.array([[0]]): |
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.
I had to read this twice... Why not if F.shape == (1, 1) and F[0, 0] == 0
? Simpler and less work for all. Also, F[0, 0] = 1 below. Sorry for overlooking this before.
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.
Fixed.
Fixed. |
Seems to be broken. |
Issue
Widget crashes on discrete attributes with only one value.
https://sentry.io/biolab/orange3/issues/243133261/
Description of changes
Check if there is a second value.
Includes