[ENH] OWTSNE: Offload computation to separate thread#3604
Merged
VesnaT merged 9 commits intobiolab:masterfrom May 9, 2019
Merged
[ENH] OWTSNE: Offload computation to separate thread#3604VesnaT merged 9 commits intobiolab:masterfrom
VesnaT merged 9 commits intobiolab:masterfrom
Conversation
d5097c9 to
db0a98e
Compare
Codecov Report
@@ Coverage Diff @@
## master #3604 +/- ##
==========================================
+ Coverage 84.9% 84.95% +0.05%
==========================================
Files 374 374
Lines 68852 69084 +232
==========================================
+ Hits 58457 58692 +235
+ Misses 10395 10392 -3 |
3 tasks
dc1f337 to
a329ccd
Compare
VesnaT
reviewed
Mar 5, 2019
VesnaT
reviewed
Mar 5, 2019
|
|
||
| def resume(self): | ||
| self.__set_update_loop(self.tsne_iterator) | ||
| self.run_button.setText("Stop") |
Contributor
There was a problem hiding this comment.
I think this line is not needed, since the text is already set in start().
Contributor
|
Maybe you could write some tests for the TSNERunner. Each its method is easily testable. And it would also be good to check that the embedding is not modified inplace. |
e628b78 to
077fc02
Compare
VesnaT
requested changes
Apr 12, 2019
Contributor
VesnaT
left a comment
There was a problem hiding this comment.
Some observations:
- OWFile (Iris) -> OWtSNE (Check Preserve global structure -> Info message appears) -> OWFile (Reload file) -> OWtSNE (Info message has disappeared)
- OWFile (Iris) -> OWtSNE
-> OWDataTable (Select 10 rows) -> OWtSNE (the same widget as above (input subset)) -> OWtSNE (Check Preserve global structure) -> OWDataTable (the same widget as above - reselect 10 rows) -> Crash
Traceback (most recent call last):
File "/Users/vesna/orange3/Orange/canvas/scheme/widgetsscheme.py", line 1082, in process_signals_for_widget
widget.handleNewSignals()
File "/Users/vesna/orange3/Orange/widgets/visualize/utils/widget.py", line 461, in handleNewSignals
self.graph.update_point_props()
File "/Users/vesna/orange3/Orange/widgets/visualize/owscatterplotgraph.py", line 554, in update_point_props
self.update_colors()
File "/Users/vesna/orange3/Orange/widgets/visualize/owscatterplotgraph.py", line 932, in update_colors
pen_data, brush_data = self.get_colors()
File "/Users/vesna/orange3/Orange/widgets/visualize/owscatterplotgraph.py", line 826, in get_colors
subset = self.master.get_subset_mask()
File "/Users/vesna/orange3/Orange/widgets/visualize/utils/widget.py", line 482, in get_subset_mask
dtype=np.bool, count=len(valid_data))
File "/Users/vesna/orange3/Orange/widgets/visualize/utils/widget.py", line 481, in <genexpr>
return np.fromiter((ex.id in self.subset_indices for ex in valid_data),
TypeError: unhashable type: 'numpy.ndarray'
- When running tsne with several interruptions I get slightly different results than without interrupting calculation:
OWFile (Iris) -> OWtSNE (Click Stop/Resume several times)
-> OWtSNE
-> Output Data vary
VesnaT
reviewed
Apr 12, 2019
VesnaT
reviewed
Apr 12, 2019
VesnaT
reviewed
Apr 12, 2019
VesnaT
reviewed
Apr 12, 2019
VesnaT
reviewed
Apr 12, 2019
VesnaT
reviewed
Apr 12, 2019
VesnaT
reviewed
Apr 12, 2019
VesnaT
reviewed
Apr 12, 2019
VesnaT
reviewed
Apr 12, 2019
VesnaT
reviewed
Apr 12, 2019
Contributor
|
The following still happens:
|
Remove this fix because OWMDS fails. I've opened biolab#3723 instead.
6b38318 to
7c1dcea
Compare
7c1dcea to
f7dbb03
Compare
6cba6f3 to
c712620
Compare
Collaborator
Author
|
@VesnaT I fixed the two issues you found above. I've fixed them in a very simple and hacky way. I tried to find an elegant solution, but any of these would require touching the base widget and then fixing the other widgets. |
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 t-SNE widget previously performed all computation inside the main thread, while simulating a thread i.e. it would pause every once in a while and handle user action. For larger data sets, this meant the widget would freeze for a while until the widget received control again.
Description of changes
The widget now offloads all of the computation into a separate thread, and the widget is only responsible for preparing a
Taskspecification, which is then handled by the other thread.Other changes include:
openTSNEimplementation, but I think it's justified because 1. in case we ever opt for a different implementation, removing this from the widget requires little effort and 2. finding the nearest neighbors can take a very long time (up to half of all the computation time for larger data sets) therefore the widget should be smart enough to cache results wherever possible.Includes