-
-
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
[ENH] OWMDS, OWLinearProjection: save selection in workflow #2301
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2301 +/- ##
==========================================
+ Coverage 74.53% 74.55% +0.01%
==========================================
Files 321 321
Lines 56134 56140 +6
==========================================
+ Hits 41838 41853 +15
+ Misses 14296 14287 -9 |
Selections are not really context settings as they depend not only on the columns in the dataset but on the number of rows as well. Have you considered using schema only settings? |
The problem I have with schema_only settings is that there's additional boilerplate associated with using them: def closeContext(self):
if self.current_context is not None:
self.selection = None
super().closeContext() Short, but very intricate. |
File -> Sample -> MDS. Select all points in MDS. Decrease the sample size in Sample. MDS crashes due to selection indices out of range. Linear projection probably as well. A saved context setting is reused when "useful", e.g. if the setting includes a variable, the variable has to appear in the domain for the context to be useful. In this sense, the context here is not the domain but the sample size (e.g. the saved selection is "useful" if there is enough data for these indices). However, this context would be too vaguely defined, so checking the domain ( One quick solution would be to discard the selection (after |
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.
Also, add tests that will check for this.
21d9aa8
to
17dd67e
Compare
Right. How is this? |
Orange/widgets/widget.py
Outdated
@@ -508,6 +508,14 @@ def closeContext(self): | |||
reinitializing the user interface (e.g. combo boxes) with the new | |||
data. | |||
""" | |||
# Clear schema-only settings when *closing* the context | |||
# FIXME: Sadly, schema-only settings aren't cleared when non-contextual |
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.
Actually, they are.
As non-context-aware widgets only load settings when a new instance of the widget is put on the canvas, this is achieved by not updating default values. See https://github.com/biolab/orange3/blob/master/Orange/widgets/settings.py#L508
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.
But what if the same instance of widget but passed different data, as described here?
Orange/widgets/widget.py
Outdated
# Clear schema-only settings when *closing* the context | ||
# FIXME: Sadly, schema-only settings aren't cleared when non-contextual | ||
# SettingsHandler is used | ||
if self.current_context is not None: |
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.
With this change, https://github.com/biolab/orange3/blob/master/Orange/widgets/visualize/owscatterplot.py#L581 is now redundant.
As the feature was implemented in a simple way, the suggestion is no longer relevant.
@@ -1028,8 +1031,9 @@ def commit(self): | |||
if output is not None and self._selection_mask is not None and \ | |||
numpy.any(self._selection_mask): | |||
subset = output[self._selection_mask] | |||
self.selection_indices = numpy.flatnonzero(self._selection_mask) |
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.
For settings, primitive types > numpy, as they can be serialized to json, resulting in human readable settings.
This looks good to me, rebase when possible so we can merge. |
df9b73c
to
1bc6449
Compare
Orange/widgets/unsupervised/owmds.py
Outdated
@@ -103,7 +103,7 @@ class Outputs: | |||
|
|||
settingsHandler = settings.DomainContextHandler() | |||
|
|||
max_iter = settings.Setting(300) | |||
max_iter = settings.Setting(10) |
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 is this change doing in a commit "save selection in workflow" ?!?
Did you change this while testing and accidentally committed it?
Or decided to change some defaults and make it less obvious by not mentioning it at all and/or putting it in its own commit.
1bc6449
to
05e0e39
Compare
Undo changes to settings from biolabgh-2301
Undo changes to settings from biolabgh-2301
* undo changes to settings from biolabgh-2301 * change selection restore in scatter plot and linear projection accordingly
* undo changes to settings from biolabgh-2301 * change selection restore in scatter plot and linear projection accordingly
* undo changes to settings from biolabgh-2301 * change selection restore in scatter plot and linear projection accordingly
Issue
Fixes #2182
Description of changes
Includes