My original data is pretty large. It is about: data =
[[0, 0, 0, ......0]
[0, 0.124, 0, ..0]
.
.
.
[0, 0, 0, 0, 0.174]]
data2 =
[[0, 0, 0, ......0]
[0, 0.74, 0, ..,0]
.
.
.
[0, 0, 0.15, 0, 0]]
10 matrix in data and data2 each matrix have 3687 value
I want to compute the cosine similarity of each matrix, that's like the first matrix in data compute the first and second to the last matrix in data2 and so on I want to get a 10X10 similarity score and I use sklearn and use sklearn.metrics.pairwise to fit the model and compute the cosine similarity:
import numpy as np
from sklearn import manifold
A = np.matrix(cop)
A = 1.-A
model = manifold.TSNE(metric="precomputed")
Y = model.fit_transform(A)
but it shows:
X should be a square distance matrix
I use a much simpler data as a trial and it does fit.
How to compute the cosine similarity and get a 10X10 cosine score?