Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
pavlin-policar committed Oct 26, 2018
1 parent 4c00e6c commit 05975e8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 4 additions & 2 deletions Orange/widgets/unsupervised/owmanifoldlearning.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ class Error(OWWidget.Error):
"neighbors must be greater than {}")
manifold_error = Msg("{}")
sparse_methods = Msg('Only t-SNE method supported on sparse data')
sparse_tsne_distance = Msg('Chebyshev, Jaccard, and Mahalanobis '
'distances not supported with sparse data.')
sparse_tsne_distance = Msg('The Chebyshev distance is not '
'supported with sparse data.')
out_of_memory = Msg("Out of memory")

@classmethod
Expand Down Expand Up @@ -300,11 +300,13 @@ def apply(self):
X = model.embedding_
out = Table(domain, X, data.Y, data.metas)
except TypeError as e:
print(e)
if 'sparse' in e.args[0] and 'distance' in e.args[0]:
self.Error.sparse_tsne_distance()
else:
raise
except ValueError as e:
print(e)
if 'sparse' in e.args[0] and 'metric' in e.args[0]:
self.Error.sparse_tsne_distance()
elif e.args[0] == "for method='hessian', n_neighbors " \
Expand Down
8 changes: 7 additions & 1 deletion Orange/widgets/unsupervised/tests/test_owmanifoldlearning.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,15 @@ def test_sparse_data(self):
self.widget.apply_button.button.click()
self.assertFalse(self.widget.Error.sparse_methods.is_shown())
self.assertFalse(self.widget.Error.sparse_tsne_distance.is_shown())
self.assertIsInstance(self.get_output(self.widget.Outputs.transformed_data), Table)
self.show()
print('-' * 80)
self.widget.params_widget.parameters['metric'] = 'chebyshev'
self.widget.apply_button.button.click()
self.assertIsInstance(self.get_output(self.widget.Outputs.transformed_data), Table)
print('-' * 80)
print(self.widget.params_widget.parameters)
print(self.widget.Error.sparse_tsne_distance.is_shown())
print(data)
self.assertTrue(self.widget.Error.sparse_tsne_distance.is_shown())

@skip
Expand Down

0 comments on commit 05975e8

Please sign in to comment.