Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions orangecontrib/network/widgets/OWNxClustering.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,23 @@ def __init__(self):
box = gui.vBox(self.controlArea, "Label Propagation")
gui.spin(
box, self, "iterations", 1, 100000, 1,
label="Max. iterations: ", callback=self.commit)
label="Max. iterations: ", callback=self.commit.deferred)
gui.doubleSpin(box, self, "hop_attenuation", 0, 1, 0.01,
label="Apply hop attenuation: ",
checked="attenuate", callback=self.commit)
checked="attenuate", callback=self.commit.deferred,
checkCallback=self.commit.deferred)
self.random_state = gui.checkBox(
box, self, "use_random_state",
label="Replicable clustering", callback=self.commit)
label="Replicable clustering", callback=self.commit.deferred)

gui.auto_apply(self.controlArea, self)

@Inputs.network
def set_network(self, net):
self.net = net
self.commit()
self.commit.now()

@gui.deferred
def commit(self):
kwargs = {'iterations': self.iterations}
if self.attenuate:
Expand Down
8 changes: 4 additions & 4 deletions orangecontrib/network/widgets/tests/test_OWNxClustering.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def test_does_not_crash_when_cluster_variable_already_exists(self):

# Should not crash
self.send_signal(self.widget.Inputs.network, graph)
self.widget.unconditional_commit()
self.widget.commit.now()

# There should be an additional cluster column
output = self.get_output(self.widget.Outputs.network).nodes
Expand All @@ -39,11 +39,11 @@ def test_reproducible_clustering(self):
self.widget.controls.use_random_state.setChecked(True)

self.send_signal(self.widget.Inputs.network, network)
self.widget.unconditional_commit()
self.widget.commit.now()
res1 = self.get_output(self.widget.Outputs.network).nodes.metas

self.send_signal(self.widget.Inputs.network, network)
self.widget.unconditional_commit()
self.widget.commit.now()
res2 = self.get_output(self.widget.Outputs.network).nodes.metas

# Seeded rerun should give same clustering result
Expand All @@ -55,7 +55,7 @@ def test_multiple_reruns_override_variable(self):

for _ in range(10):
self.send_signal(self.widget.Inputs.network, network)
self.widget.unconditional_commit()
self.widget.commit.now()

output = self.get_output(self.widget.Outputs.network).nodes
# Multiple reruns should override the results instead of adding new feature every time
Expand Down