-
-
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] Manifold Learning: handling numpy LinAlgError #2228
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2228 +/- ##
==========================================
+ Coverage 72.26% 72.28% +0.01%
==========================================
Files 318 318
Lines 54856 54867 +11
==========================================
+ Hits 39644 39658 +14
+ Misses 15212 15209 -3 Continue to review full report at Codecov.
|
@@ -260,6 +262,8 @@ def apply(self): | |||
self.Error.n_neighbors_too_small("{}".format(n)) | |||
else: | |||
self.Error.manifold_error(e.args[0]) | |||
except np.linalg.linalg.LinAlgError as e: | |||
self.Error.manifold_error(e.args[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.
Use str(e)
instead of e.args[0]
.
Calling str()
on an instance of BaseException
will give something at least as good as `e.args[0].
Actually, even self.Error.manifold_error(e)
but I'd prefer being explicit.
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.
def test_data_which_makes_singular(self): | ||
""" | ||
Sometimes singular matrix is calculated from input data and | ||
that should be handled. |
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.
Rephrase: Handle singular matrices
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.
@@ -73,3 +73,25 @@ def test_sparse_data(self): | |||
self.send_signal("Data", None) | |||
self.widget.apply_button.button.click() | |||
self.assertFalse(self.widget.Error.sparse_not_supported.is_shown()) | |||
|
|||
def test_data_which_makes_singular(self): |
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.
test_singular_matrices
or something like that?
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.
list(zip( | ||
[1, 1, 1], | ||
[0, 1, 2], | ||
[0, 1, 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.
Would a simpler, more obviously singular matrix, like all zeros, work here as well?
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.
Yes, matrix with all zeros would work here as well. But I just wanted to point out that regular matrix can crash the code as well.
Issue
https://sentry.io/biolab/orange3/issues/210202559/
Description of changes
Sometimes singular matrix is calculated from input data and that is now handled.
Includes