Skip to content

Commit

Permalink
Merge pull request #5668 from pavlin-policar/opentsne-pickle
Browse files Browse the repository at this point in the history
tsne: require opentsne 0.6.1
  • Loading branch information
PrimozGodec authored Oct 25, 2021
2 parents 8ef0aec + d3273f9 commit f4b412d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
22 changes: 21 additions & 1 deletion Orange/tests/test_manifold.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Test methods with long descriptive names can omit docstrings
# pylint: disable=missing-docstring

import pickle
import platform
import unittest

import numpy as np
Expand Down Expand Up @@ -245,3 +246,22 @@ def test_fft_correctness(self):
knn.fit(model.embedding_, self.iris.Y)
predicted = knn.predict(model.embedding_)
self.assertTrue(accuracy_score(predicted, self.iris.Y) > 0.95)

@unittest.skipIf(platform.system() == "Windows", "Files locked on Windows")
def test_pickle(self):
for neighbors in ("exact", "approx"):
tsne = TSNE(early_exaggeration_iter=0, n_iter=10, perplexity=30,
neighbors=neighbors, random_state=0)
model = tsne(self.iris[::2])

loaded_model = pickle.loads(pickle.dumps(model))

new_embedding = loaded_model(self.iris[1::2]).X

knn = KNeighborsClassifier(n_neighbors=5)
knn.fit(new_embedding, self.iris[1::2].Y)
predicted = knn.predict(new_embedding)
self.assertTrue(
accuracy_score(predicted, self.iris[1::2].Y) > 0.95,
msg=f"Pickling failed with `neighbors={neighbors}`",
)
2 changes: 1 addition & 1 deletion conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ requirements:
- python-louvain >=0.13
- requests
- matplotlib-base >=2.0.0
- openTSNE >=0.6.0
- openTSNE >=0.6.1
- pandas >=1.0.0
- pyyaml
- orange-canvas-core >=0.1.21,<0.2a
Expand Down
2 changes: 1 addition & 1 deletion requirements-core.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ serverfiles # for Data Sets synchronization
networkx
python-louvain>=0.13
requests
openTSNE>=0.6.0
openTSNE>=0.6.1
baycomp>=1.0.2
pandas>=1.0.0
pyyaml
Expand Down

0 comments on commit f4b412d

Please sign in to comment.