Skip to content
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] Visualize widgets: Output Annotated data and Fixups #1677

Merged
merged 11 commits into from
Oct 21, 2016

Conversation

VesnaT
Copy link
Contributor

@VesnaT VesnaT commented Oct 19, 2016

No description provided.

@@ -1146,7 +1146,7 @@ def commit(self):
selected_data = data[mask]
if self.append_clusters:
def remove_other_value(vars_):
vars_ = [var for var in vars_]
vars_ = list(vars_).copy()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooops, in my earlier comment I thought that vars_ was a list. Sorry. Now that you have to convert it to a list anyway, list(vars_) will suffice; you can skip copy().

@codecov-io
Copy link

codecov-io commented Oct 20, 2016

Current coverage is 89.39% (diff: 100%)

Merging #1677 into master will not change coverage

@@             master      #1677   diff @@
==========================================
  Files            79         79          
  Lines          8603       8603          
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
  Hits           7691       7691          
  Misses          912        912          
  Partials          0          0          

Sunburst

Powered by Codecov. Last update 7dca993...635ba39

Copy link
Contributor

@janezd janezd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work. Adding the signal to the widget is really smooth (and easy to check :), and you had the patience to write some reasonable tests, too.

all((var in [var.name for var in annotated.domain.metas]
for var in [var.name for var in selected.domain.metas])))
self.assertLess(set(var.name for var in selected.domain.metas),
set(var.name for var in annotated.domain.metas))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to change anything here, but: you can also use set comprehensions in such cases. (I keep forgetting this, too.)

@@ -224,6 +229,8 @@ def set_tree(self, model=None):
# if hasattr(model, 'meta_depth_limit'):
# self.depth_limit = model.meta_depth_limit
# self.update_depth()
self.send(ANNOTATED_DATA_SIGNAL_NAME,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed? The "Selected data" signal is not sent here. I commented it out and it seems it still works.

@@ -347,6 +355,11 @@ def commit(self):
data = self.tree_adapter.get_instances_in_nodes(
self.clf_dataset, [item.tree_node.label for item in items])
self.send('Selected Data', data)
nodes = [i.tree_node.label for i in self.scene.selectedItems()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this already computed above, as the second argument in the call of get_instances_in_nodes?

@@ -18,8 +20,9 @@ class OWRuleViewer(widget.OWWidget):
inputs = [("Data", Table, 'set_data'),
("Classifier", _RuleClassifier, 'set_classifier')]

data_output_identifier = "Filtered data"
outputs = [(data_output_identifier, Table)]
data_output_identifier = "Selected Data"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hate this.

First, it should be upper case -- if for nothing else, to match the case of ANNOTATED_DATA_SIGNAL_NAME.

Second, it's probably the only widget which defines a constant for the signal name. This could be a good idea, but only if we do it elsewhere too.

It's not your fault (it was here before), and removing it is not a part of this PR. But since you have to rename it anyway, you could perhaps simply get rid of it. Just a suggestion, you don't have to.

Copy link
Contributor

@janezd janezd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll merge this after merging #1171 since eventual rebasing of this PR (if needed) will be easier than rebasing of #1171.

@janezd
Copy link
Contributor

janezd commented Oct 21, 2016

@VesnaT, a small rebase, please.

@VesnaT VesnaT force-pushed the annotated_data branch 2 times, most recently from cc350f6 to 86e2ebd Compare October 21, 2016 14:39
@janezd janezd merged commit c90e602 into biolab:master Oct 21, 2016
@astaric astaric modified the milestone: 3.3.9 Nov 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants