Questions tagged [cosine-similarity]
An angular-type similarity coefficient between two vectors. It is like correlation, only without centering the vectors.
135
questions
0
votes
0
answers
31
views
Calculate the cosine similarity between two probability measures, rather then between two vectors
Introduction. The cosine similarity is often calculated among two vectors, i.e. $C_S(X,Y)$:
\begin{equation}
C_S(X,Y) = \frac{\sum_{i=1}^{n}(X_i,Y_i)}{\sqrt{\sum_{i=1}^{n}X_{i}^{2} \sum_{i=1}^{n}Y_{i}^...
0
votes
0
answers
13
views
How to adjust similarity scores by removing the influence of a common vector?
I have a similarity score function, $s(x,y)$. I know that I have two items that I'm trying to compare the similarity of, but both are based on the same template. How would I remove the template from ...
0
votes
0
answers
24
views
Similarity measure for non-binary user preference vector
Cosine similarity can be used to measure the similarity between two vectors that encode the user preferences with the following values:
0: No user feedback (e.g. the user never viewed a merchandise)
...
1
vote
1
answer
51
views
Normalizing Euclidean distance by the length of the vectors [closed]
Suppose I have 4 vectors, the first 2 vectors are of length 4 and the last 2 vectors are of length 400. all values in the vectors range from 0.5 to 0.6.
The Euclidean distance between the last 2 ...
1
vote
1
answer
45
views
Is it wrong to view convolution as template matching?
I am reading about the convolution operation but I can't see how it can be seen as template matching.
Suppose that we convolve the input $\mathbf{X}$:
$$
\begin{bmatrix}
1 & 0 & 0 & 0 \\
0 ...
0
votes
0
answers
15
views
Word2Vec with some Levenshtein metric
I'm building a search engine of technical documents based on Word2Vec, using cosine similarity metric. This search engine is very specific because it is meant to work with technical writings written ...
2
votes
1
answer
23
views
Composed cosine similarity
I have the following problem.
I have 3 vectors $u,v,w$ of n dimensions.
I'm able to find cosine similarities between $u$ and $v$, and between $v$ and $w$: $cosine(u,v)$ and $cosine(v,w)$.
Can i use ...
0
votes
1
answer
77
views
How to interpret NearestNeighbor results obtained using cosine similarity for tf-idf vectors
Why is the top result obtained using cosine similarity extremely close to 0 not the expected 1?
That implies complete orthogonality.
Data:
100k documents/rows with 2000 features(TF_IDF values of ...
0
votes
0
answers
31
views
Combine TF-IDF with Supervised Learning for Semantic Similarity
I use TF-IDF to compute text similarity scores. It correctly identifies words, that are unique to a document in comparison to the whole corpus. In my case project names and codes are a strong ...
0
votes
1
answer
125
views
Can you calculate the mean of a multivariate normal distribution for the cosine similarity?
Let ${\displaystyle \mathbf {X} =(X_{1},\ldots ,X_{k})^{\mathrm {T} }}$ be a sample from a multivariate normal distribution ${\displaystyle \mathbf {X} \ \sim \ {\mathcal {N}}({\boldsymbol {\mu }},\,{...
0
votes
0
answers
22
views
What’s a good scale robust similarity metric?
Context: While designing an experiment, there is interest from leadership in pairing control and test units together such that every (test, control) pair are as categorically similar as possible.
...
0
votes
0
answers
172
views
How to choose between Cosine similarity and Pearson Correlation Coefficient?
I have two arrays. One is the simulated reflection coefficient from an antenna. The other is the measured reflection coefficient for the same antenna. Both the arrays have values for the same ...
1
vote
0
answers
21
views
Issue on computing correlation coefficient for two vectors
This is a super trivial question, but for some reason I am stuck and I simply don't get what I am missing/doing wrong.
The cosine similarity is defined as followed:
I have this dataset, of points ...
2
votes
0
answers
182
views
What does the PCA similarity factor tell us?
I found the following formula for comparing time series
$$ S_{\mathrm{PCA}}^{\lambda}=\frac{\sum \limits_{i=1}^{k} \sum \limits_{j=1}^{k}\left(\lambda_{i}^{(1)} \lambda_{j}^{(2)}\right) \cos ^{2} \...
0
votes
0
answers
21
views
Should I do documents transformation at once or a pair at a time for auto grading with cosine similarity?
I'm developing auto grading essay that compares the similarity between the answer key and student answer with cosine similarity. This one is written in php. Let's say in a course there are 30 - 100 ...
0
votes
0
answers
22
views
making Cosine Similarity contribution clear
I've not found a similar question.
For ~8 dimensional data, is there a standard method to calculate the contribution of each dimension to the overall similarity score between pairs of data?
I am ...
0
votes
0
answers
32
views
Is word2vec or LSA a better model for disambiguating word similarity
I have an assignment coming up that asks of me to use either word2vec or LSA to disambiguate similarity between words. Which model do you think would perform better and why?
I know that the two models ...
1
vote
0
answers
46
views
Similiarity between two corpus of text
I have two separated corpus of text, and i would like to understand wheter these are similiar or not using cosine similarity.
I'm not sure on how to approach this problem, but i was thinking as a ...
0
votes
0
answers
45
views
Mahalanobis distance for a vector with (also) angular data
I have a vector of data that is composed of 9 values:
position in 3d
orientation in 3d
size in 3d.
Obviously, angles are "circular" values, that is 359deg is near to 1deg, but $359 - 1 = ...
1
vote
1
answer
77
views
Geometric Explanation of R-Squared
Suppose we have two orthogonal features $x_1$ and $x_2$. If we run univariate regression of $y$ on $x_1$ or $x_2$ and get $R^2, $$r_1$ and $r_2$ and we run multivariate regression of $y$ on both $x_1$ ...
0
votes
0
answers
81
views
Centroid in sklearn cosine similarity
What is the centroid of the unit sphere that is assumed in the sklearn cosine similarity function?
1
vote
1
answer
21
views
Algorithm to find closest document containing a set of strings, or variations of them
I have one dataset (A) containing several fields (strings) per sample. One of these fields is a name, and the others are all alphanumeric identifiers.
I have another dataset (B) which contains highly ...
3
votes
1
answer
258
views
Centering in normalized cross correlation for template matching
Context
I'm following Lewis (1995) exposition on normalized cross correlation for template matching (Section 2).
The cross-correlation of the image and the feature at $u,v$ is denoted by $c(u,v)$ and ...
0
votes
0
answers
125
views
Is cosine similarity enough to measure word embedding similarity?
Is cosine similarity a good metric to measure word embedding similarity? Suppose that we have two vectors of word embedding in same direction but with different length( first one with len=1 and second ...
1
vote
0
answers
543
views
Cosine Similarity of the word embeddings after UMAP dimensionality reduction
I want to calculate similarities of the word embeddings. As a basis I took SpaCy german corpus: nlp = spacy.load("de_core_news_lg").
I have approximately ...
1
vote
0
answers
228
views
How to calculate euclidian distance from similarity matrix
I have a similarity matrix but can not use it in the k-mean as input. So is there any way to convert the similarity matrix to the euclidean distance matrix?
Edit: I have Jaccard, overlap, cosine,(...
0
votes
0
answers
364
views
Scalar similarity measure between two vectors including both angle and magnitude
I have different models, predicting a vector $\boldsymbol{v}\in\mathbb{R}^3$. Now I would like to compare the performance of these models against a baseline vector $\boldsymbol{b}\in\mathbb{R}^3$, for ...
2
votes
1
answer
1k
views
Cosine similarity seems to perform better with higher dimensions than Euclidean distance? Should this be the case?
I've generated 100 random vectors (data points) in n∈[1,...,50] dimensions. I then compared distances between each pair of vectors and calculated the mean value. I've done this for all dimensions ...
0
votes
0
answers
76
views
How Can I Reduce Similarity Analysis of Multiple Time-Series Vectors into a Single Value?
I have ~15 independently-sourced vectors with about 1600 samples in each. They are basically continuous, ~1 Hz, from t=0 to 22 minutes. The nature of the dataset is such that the signals are ...
0
votes
1
answer
69
views
Search, rank and recommend in large text datasets
Imagine you are Spotify and you have billions of songs. Assume that each of these songs are transcribed into text. How do you design your search and recommendation pipeline such that when somebody ...
0
votes
0
answers
71
views
Why is cosine similarity a lot higher between one document and all other documents grouped than vs the mean of each
I am trying to calculate a cosine similarity score for speeches made by various politicians.
Say I have politician A who belongs to party A. Party A has 20 other politicians who have made a total of ...
1
vote
1
answer
750
views
cosine similarity with weights
We're doing pairwise similarity computation for some real estate properties. Our data goes something like this:
...
0
votes
0
answers
46
views
measure the overall similarity between two vectors
I have two paired vectors which report the number of times each object was found in the two experiments (the count value could be 0 or greater (e.g. 5,10,1000, etc)). I want to compare them and get a ...
1
vote
0
answers
345
views
Cosine similarity with vectors of different lengths (time series)
I have time series of different lengths with different patterns. I want to find the similarity between them in such a way that it is defined from 0 to 1 and the measure takes into account the length (...
0
votes
0
answers
56
views
Searching for a distance metric or distance similarity to compare two arrays of counts
Every object in my dataset is described as a vector of n = 200 continuous counts. I need to choose a measure to evaluate the similarity of two objects in the dataset. I want to satisfy the following ...
1
vote
0
answers
42
views
Should I consider the contribution of a variable in correspondance analysis if the $cos^2$ is weak?
So I have this table that represents contribution and cosinus of variable in CA
I noticed that the most popular choice ( 1-5 hours ) has the weakest contributions and the weakest cosinus.
It made ...
1
vote
0
answers
93
views
Cosine similarity with recentering - collaborative filtering
I don’t know much about stats (nor maths), so I’m sorry if I’m not being very clear on this...
I’m trying to build a simple recommender system for books using collaborative filtering item by item.
I’...
2
votes
0
answers
232
views
Question related to using Pooled Output from BERT for similarity between sentences
I was hoping someone could give me advice and feedback on my current approach and possibly suggest to me a possible alternative. I'm trying to find the sentences that are most similar using the pooled ...
3
votes
0
answers
803
views
Finding Cosine similarity threshold (cut-off point) with Logistic Regression
I want to preprocess my data sets, removing similar articles. To do this, I'll perform cosine similarity, I don't know the best threshold (cut-off point) of my data set. I Found in this paper, there's ...
0
votes
0
answers
862
views
Calculate similarity between two matrices
I have two matrices, $A$ and $B$, each of size $n\times m$, where $n$ is discrete time points, and $m$ are the variables measured (specifically, $n$ are dates and $m$ are investments measured in ...
1
vote
1
answer
537
views
Baffled by cosine similarity - these results seem counterintuitive
Haven't used cosine similarity much in the past so getting into it now. Seeing results that are counterintuitive and would love your help making sense of them.
Assume these simple vectors:
...
1
vote
0
answers
523
views
Euclidian distance vs cosine similarity
Currently I'm working on facial recognition. If I use encoding/feature vectors of 2 images which method will prove more accuracy, L2 norm or cosine similarity and why?
I read "ICA performs ...
2
votes
1
answer
588
views
Cosine similarity for Categorical datasets?
Can I use Cosine similarity measure for estimating similarity/relationship between D1 and D2 (two categorical datasets)
0
votes
0
answers
47
views
How to calculate similarity between two sets of items rated on a single dimension?
(I'm just making up variables for this example.)
Let's say I have 100 words rated on their pleasantness.
I also have 100 images rated on their pleasantness.
I then had participants rate the fit ...
1
vote
0
answers
33
views
cosine of angle between random variables is equal to the correlation coefficient? [duplicate]
I have seen this said multiple times where (1) the cosine of the angle between the random variables (on a vector space) is equal to the correlation coefficient, and (2) the claim if random variables ...
2
votes
1
answer
523
views
Difference between an interaction and combining two variables into one with a similarity measure?
Conceptually, what would be the difference between interacting two variables in a regression and combining these two variables into one via a similarity measure? I'm looking at top managers and boards ...
0
votes
0
answers
38
views
What are the conditions for 2-dimensional curve fitting when the estimator function is a type of sine and cosine?
What are the conditions for 2-dimensional curve fitting when the estimator function is a type of sine and cosine?
For example I wanted to estimate F=xy with Asin (((n*pi)/L)*x)sin ((((npi)/L)*z) ...
1
vote
0
answers
156
views
Which text similarity algorithm should I use to compare the context of Instagram hashtags?
For a study I am comparing companies based on the posts written by their Instagram followers. I apply the following technique:
Nike has 1.000.000 followers.
2000 random followers of Nike are selected ...
3
votes
1
answer
567
views
Should we apply PCA before calculating similarities in high-dimensional space if my observations have length 1?
I have high-dimensional space (around 20 features) and I want to calculate similarity based on the angle of observation, not the magnitude. I have a nice function that can compute euclidean distance ...
3
votes
0
answers
249
views
Normalized Levenshtein distance and triangle inequality
One question regarding to the triangle inequality of normalized Levenshtein Distance. I use the well-known form D(X,Y) = 1 - d(X,Y) / MAX(|X|,|Y|) where ...