From 63a3dca44b405c001fcdcd75f9ecc08c07b903ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavlin=20Poli=C4=8Dar?= Date: Sat, 27 Oct 2018 17:45:35 +0200 Subject: [PATCH] OWManifoldLearning: Re-add chebyshev and jaccard distance to t-SNE --- .../unsupervised/owmanifoldlearning.py | 4 +--- .../tests/test_owmanifoldlearning.py | 19 +++++++++++++++++++ conda-recipe/meta.yaml | 2 +- requirements-core.txt | 2 +- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/Orange/widgets/unsupervised/owmanifoldlearning.py b/Orange/widgets/unsupervised/owmanifoldlearning.py index b7112c8621f..bb589f69313 100644 --- a/Orange/widgets/unsupervised/owmanifoldlearning.py +++ b/Orange/widgets/unsupervised/owmanifoldlearning.py @@ -88,11 +88,9 @@ def __radio_parameter_update(self, name): class TSNEParametersEditor(ManifoldParametersEditor): - _metrics = ("manhattan", "chebyshev") + _metrics = ("euclidean", "manhattan", "chebyshev", "jaccard") metric_index = Setting(0) metric_values = [(x, x.capitalize()) for x in _metrics] - # rename l2 to Euclidean - metric_values = [("l2", "Euclidean")] + metric_values perplexity = Setting(30) early_exaggeration = Setting(12) diff --git a/Orange/widgets/unsupervised/tests/test_owmanifoldlearning.py b/Orange/widgets/unsupervised/tests/test_owmanifoldlearning.py index 84c72a333f4..72cd611bdcc 100644 --- a/Orange/widgets/unsupervised/tests/test_owmanifoldlearning.py +++ b/Orange/widgets/unsupervised/tests/test_owmanifoldlearning.py @@ -85,6 +85,25 @@ def __callback(): self.widget.manifold_methods_combo, callback=__callback, ) + def test_metrics(self): + # Select t-SNE method, which is the only method that supports metrics + simulate.combobox_activate_item(self.widget.manifold_methods_combo, "t-SNE") + + def __callback(): + # Send data to input + self.send_signal(self.widget.Inputs.data, self.iris) + self.widget.apply_button.button.click() + self.assertFalse(self.widget.Error.manifold_error.is_shown()) + + # Clear input + self.send_signal(self.widget.Inputs.data, None) + self.widget.apply_button.button.click() + self.assertFalse(self.widget.Error.manifold_error.is_shown()) + + simulate.combobox_run_through_all( + self.widget.tsne_editor.metric_combo, callback=__callback, + ) + @skip def test_singular_matrices(self): """ diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml index 1e8ded645d3..ba6c419ef92 100644 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.yaml @@ -51,7 +51,7 @@ requirements: - commonmark - serverfiles - matplotlib >=2.0.0 - - fasttsne >=0.2.9 + - fasttsne >=0.2.10 test: # Python imports diff --git a/requirements-core.txt b/requirements-core.txt index 3dc6d61951c..c67bdee0f03 100644 --- a/requirements-core.txt +++ b/requirements-core.txt @@ -16,4 +16,4 @@ serverfiles # for Data Sets synchronization networkx python-louvain requests -fastTSNE>=0.2.9 +fastTSNE>=0.2.10