Last active
September 5, 2017 19:41
-
-
Save romankierzkowski/8eae3f45ea5f50913763292d33afae96 to your computer and use it in GitHub Desktop.
T-SNE with sparse matrix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.neighbors import kneighbors_graph | |
from sklearn.manifold import TSNE | |
import numpy as np | |
X = np.random.rand(100,10) | |
distances = kneighbors_graph(X, n_neighbors=40, mode="distance", metric="cosine") | |
X_embedded = TSNE(n_components=2, metric="precomputed").fit_transform(distances) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment