Questions tagged [tsne]
58 questions
6
votes
1 answer
T-SNE can not convert high dimension data to more than 4 dimension
I wanted to use T-sne features for DBSCAN clustering algorithm, but sklearn implementation is not running for n_components>4.
from sklearn.manifold import TSNE
X = np.array([[0, 0, 0,2, 0, 0,2], [0, 1, 1,53, 0, 0,2], [1, 0, 1,12, 0, 0,2], [1, 1,…

Chandan Malla
- 481
- 5
- 14
5
votes
1 answer
How to implement t-SNE in tensorflow?
I am trying to implement a t-SNE visualization in tensorflow for an image classification task. What I mainly found on the net have all been implemented in Pytorch. See here.
Here is my general code for training purposes which works completely fine,…

SH_Clarity
- 63
- 2
- 7
4
votes
1 answer
Reduced dimensions visualization for true vs predicted values
I have a dataframe which looks like this:
label predicted F1 F2 F3 .... F40
major minor 2 1 4
major major 1 0 10
minor patch 4 3 23
major patch 2 1 11
minor minor …

Brie MerryWeather
- 132
- 3
- 13
3
votes
1 answer
Calculating the cluster size in t-SNE
I've been working on t-SNE of my data using DBSCAN. I then assign the obtained values to the original dataframe and then plot it with seaborn scatterplot. This is the code:
from sklearn.manifold import TSNE
tsne_em = TSNE(n_components=3,…

Zaki
- 45
- 4
2
votes
1 answer
t-SNE for multiple datasets in R
I have 7 datasets, each one of them have two types of dataframe: Metadata, contains a super important column that shows who is a responder and who is not, and a dataframe about cell types.
Sample using dput: This is an example from one of the…

Programming Noob
- 1,232
- 3
- 14
2
votes
1 answer
Annotating a few points on a tSNE plot - if possible, a couple of points per cluster
I have a list of ~500 embedding vectors (each embedding vector is length 400, too long to post, but this is an example of the start of one of them:
[-1.5425615, -0.52326035, 0.48309317, -1.3839878, -1.3774203, -0.44861528, 3.026304, -0.23582345,…

Slowat_Kela
- 1,377
- 2
- 22
- 60
1
vote
0 answers
All intermediate steps should be transformers and implement fit and transform or be the string 'passthrough'
I was studying In Depth: k-Means Clustering section from the textbook Jake VanderPlas's Python Data Science Handbook and I came across the following code block:
from sklearn.datasets import load_digits
from sklearn.manifold import TSNE
from…

nakoshimati
- 11
- 4
1
vote
1 answer
The sklearn.manifold.TSNE gives different results for same input vectors
I give TSNE a list of vectors, some of these vectors are exactly the same. But the output of fit() function can be different for each!
IS this expected behavior? How can i assure each input vector will be mapped to same output vector?
Exclamation,
I…

Samer Aamar
- 1,298
- 1
- 15
- 23
1
vote
1 answer
Plot Pytorch vectors with TSNE
I am using the ESM-1b model to train it with some protein sequences. I already have the vectors and now I wanted to plot them using TSNE. However, when I try to pass the vectors to the TSNE model I get:
'list' object has no attribute 'shape'`
How…

eneko valero
- 457
- 3
- 14
1
vote
0 answers
My 6D data only has 2 unique points out of 512 data points, but my 2D t-SNE plot is super spread out. What's going on?
So I have this code that generates and plots t-SNE. actions is (512,12) so 512, 12-dimensional points. When I put this into the command line:
actions.unique(dim=0).shape
torch.Size([2, 12])
We can see that there are only 2 unique points. But after…

Gooby
- 621
- 2
- 11
- 32
1
vote
1 answer
How do I color clusters after k-means and TSNE in either seaborn or matplotlib?
I have a dataframe that look something like this:
transformed_centroids = model2.fit_transform(everything)
df = pd.DataFrame()
df["y"] = model.labels_
df["comp-1"] = transformed_centroids[-true_k:, 0]
df["comp-2"] = transformed_centroids[-true_k:,…
1
vote
1 answer
OpenTSNE pickle/preserve transformer
Trying to use openTSNE because of the feature it is able to transform embeddings into an existing embeddings space.
I am trying to save the fit/trained embeddings object, so I can use it later but always getting error on pickling.
Here is an example…

Tamás Majszlinger
- 39
- 6
1
vote
1 answer
How to plot tsne on word2vec (created from gensim) for the most_similar 20 cases?
I am using TSNE to plot a trained word2vec model (created from gensim):
labels = []
tokens = []
for word in model.wv.vocab:
tokens.append(model[word])
labels.append(word)
tsne_model = TSNE(perplexity=40, n_components=2, init='pca',…

mrbangybang
- 683
- 1
- 9
- 22
1
vote
1 answer
matplotlib scatter Valueerror: 'c' argument has n elements, which is not acceptable for use with 'x' and 'y' with size m
I am trying to use matplotlib scatter plot on Python (Jupyter Notebook) to create a t-sne visualization, with different colors for different points.
I am ashamed to admit that I have mostly borrowed prewritten code, so some of the nuance is far…

SAS2507
- 13
- 4
1
vote
1 answer
Calculating mse for multiple dimensionality reduction technique
I'm trying to find a metric to compare multiple dimensionality reduction techniques similar to what was done in this blog post pca-vs-autoencoders-for-dimensionality-reduction...
Specifically this part of the comparison
# pCA…

Hammao
- 801
- 1
- 9
- 28