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

[FIX] Fix wrong assert in heatmap #4955

Merged
merged 2 commits into from
Aug 25, 2020
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
4 changes: 0 additions & 4 deletions Orange/widgets/visualize/owheatmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -796,12 +796,10 @@ def cluster_rows(self, data: Table, parts: 'Parts', ordered=False) -> 'Parts':
matrix = Orange.distance.Euclidean(subset)

if cluster is None:
assert len(matrix) < self.MaxClustering
cluster = hierarchical.dist_matrix_clustering(
matrix, linkage=hierarchical.WARD
)
if ordered and cluster_ord is None:
assert len(matrix) < self.MaxOrderedClustering
cluster_ord = hierarchical.optimal_leaf_ordering(
cluster, matrix,
)
Expand Down Expand Up @@ -833,12 +831,10 @@ def cluster_columns(self, data, parts: 'Parts', ordered=False):

if cluster is None:
assert matrix is not None
assert len(matrix) < self.MaxClustering
cluster = hierarchical.dist_matrix_clustering(
matrix, linkage=hierarchical.WARD
)
if ordered and cluster_ord is None:
assert len(matrix) < self.MaxOrderedClustering
cluster_ord = hierarchical.optimal_leaf_ordering(cluster, matrix)

col_groups.append(col._replace(cluster=cluster, cluster_ordered=cluster_ord))
Expand Down
15 changes: 10 additions & 5 deletions Orange/widgets/visualize/tests/test_owheatmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,18 @@ def test_error_message(self):

def test_information_message(self):
self.widget.set_row_clustering(Clustering.OrderedClustering)
continuizer = Continuize()
cont_titanic = continuizer(self.titanic)
self.widget.MaxClustering = 1000
self.send_signal(self.widget.Inputs.data, cont_titanic)
self.widget.MaxClustering = 20
self.widget.MaxOrderedClustering = 15
data = self.brown_selected[:, :10]
self.send_signal(self.widget.Inputs.data, data[:15])
self.assertFalse(self.widget.Information.active)
self.send_signal(self.widget.Inputs.data, data[:16])
self.assertTrue(self.widget.Information.active)
self.send_signal(self.widget.Inputs.data, self.data)
self.assertEqual(self.widget.row_clustering, Clustering.Clustering)
self.send_signal(self.widget.Inputs.data, data[:20])
self.assertFalse(self.widget.Information.active)
self.send_signal(self.widget.Inputs.data, data[:21])
self.assertTrue(self.widget.Information.active)

def test_settings_changed(self):
self.send_signal(self.widget.Inputs.data, self.data)
Expand Down