Skip to content

Commit

Permalink
tSNE: Wrap fastTSNE initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
VesnaT committed Dec 21, 2018
1 parent 0aa6e51 commit b55c4f5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 5 additions & 0 deletions Orange/projection/manifold.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,3 +483,8 @@ def __call__(self, data: Table) -> TSNEModel:
model.name = self.name

return model

@staticmethod
def default_initialization(data, n_components=2, random_state=None):
return fastTSNE.initialization.pca(
data, n_components, random_state=random_state)
4 changes: 1 addition & 3 deletions Orange/widgets/unsupervised/owtsne.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
from AnyQt.QtCore import Qt, QTimer
from AnyQt.QtWidgets import QFormLayout

import fastTSNE.initialization

from Orange.data import Table, Domain
from Orange.preprocess.preprocess import Preprocess, ApplyDomain
from Orange.projection import PCA, TSNE, TruncatedSVD
Expand Down Expand Up @@ -208,7 +206,7 @@ def __start(self):

# We call PCA through fastTSNE because it involves scaling. Instead of
# worrying about this ourselves, we'll let the library worry for us.
initialization = fastTSNE.initialization.pca(
initialization = TSNE.default_initialization(
self.pca_data.X, n_components=2, random_state=0)

# Compute perplexity settings for multiscale
Expand Down

0 comments on commit b55c4f5

Please sign in to comment.