Questions tagged [cosine-distance]

A measure of the angular distance between two vectors. Usually defined as 1-(cosine similarity).

Filter by
Sorted by
Tagged with
10
votes
1answer
13k views

Cosine Distance as Similarity Measure in KMeans [duplicate]

I am currently solving a problem where I have to use Cosine distance as the similarity measure for k-means clustering. However, the standard k-means clustering package (from Sklearn package) uses ...
0
votes
1answer
13 views

Does it make sense to normalize vectors after PCA for cosine distance?

I start off with word2vec embeddings and process them in the following way: Standardize dimensions to mean 0 and standard deviation of 1 PCA to keep the top k-dimensional eigenvector, whereby ...
1
vote
5answers
2k views

How to find the similarity between movie preferences (in the form of a probability vector)of two users?

I am working on recommender systems, and using some methodology I have got a probability of each user liking a movie. To elaborate, say user $u_1$ has the following distribution for movie preferences ...
1
vote
0answers
21 views

How can I define a accuracy measure for word2vec predictions

I have a data set consisting of tags and some classes.I'm suppose to find the nearest class to each set of tags with Word2vec embeddings and cosine similarity.Each set of tags have multiple classes ...
1
vote
1answer
577 views

Cosine Similarity Intuition

I understand what cosine similarity is and how to calculate it, specifically in the context of text mining (i.e. comparing tf-idf document vectors to find similar documents). What I'm looking for is ...
7
votes
4answers
7k views

k-means cluster, How to re-calculate centroid when using cosine similarity?

I have a requirement using k-means cluster method with cosine similarity instead of Euclidean distance. for example: ...
2
votes
0answers
43 views

Are there advanced “cos similarity” that influence of dim size is less?

I found that the cosine similarity is affected to the effect of "Curse of dimension" by trying the following simulation. create(select) two vectors form uniform random numbers U[-1, 1], each dim = 2,...
0
votes
0answers
15 views

Feature analyzing methods

I am a little confiused how to interpret following situation: I am trying to implement a image classification task using hog+SVM. For that i tried to analyze and understand the properties of the ...
0
votes
0answers
35 views

Replacement for angular distance metric

I am looking for a distance metric that could be used instead of cosine/angular distance for high dimensional data. Metric that is limited the same way as cosine/angular distance is would be great. ...
0
votes
1answer
84 views

Correctness of a skewed cosine similarity graph

I am currently implementing a word2vec model that uses the cosine similarity to determine the similarity between two vectors. When plotting all the possible cosine similarities, I get the following ...
3
votes
1answer
4k views

Proving that cosine distance function defined by cosine similarity between two unit vectors does not satisfy triangle inequality

How to prove that the cosine distance function defined by cosine similarity between two unit vectors does not satisfy the triangle inequality?
4
votes
1answer
2k views

Is feature normalisation needed prior to computing cosine distance?

I have a dataset of equal length feature vectors, where each vector contains around 20 features extracted from an audio file (fundamental frequency, BPM, ratios of high to low frequencies etc). I am ...
0
votes
0answers
790 views

Cosine similarity and normalization

When I normalize a data set and compute the cosine similarity between the rows, the cosine similarity differs from the one without any normalization. Say there are 4 2D vectors: (1, 1), (2, 2), (1, 2)...
5
votes
0answers
135 views

What is the benefit of picking a distance which is a metric?

A popular distance measure, cosine similarity/distance, is not a proper metric because it fails to satisfy one of the conditions (the triangle inequality). However, there is no disadvantage whatsoever ...
1
vote
0answers
133 views

does dimensionality reduction work in similarity measures?

I'm performing classification via cosine similarity to vector means. Normally, we reduce dimensionality of a problem in order to reduce confusion to the classifier. Mathematically, will ...
1
vote
0answers
180 views

Supervised cosine similarity

Suppose we have some samples, each sample is with two vectors and the corresponding label. That is, it looks like ($\mathbf{u}_i, \mathbf{v}_i, y_i$), where $y_i \in \{0, 1\}$ We can calculate the ...
1
vote
1answer
653 views

Item-item similarity using adjusted cosine / Pearson correlation

I'm following a lecture that explains how to calculate item-item similarities using adjusted cosine distance (or Pearson correlation). I tried implementing this and have not gotten the same results. ...
10
votes
3answers
17k views

K-means on cosine similarities vs. Euclidean distance (LSA)

I am using latent semantic analysis to represent a corpus of documents in lower dimensional space. I want to cluster these documents into two groups using k-means. Several years ago, I did this using ...
1
vote
0answers
3k views

Cosine similarity is bad distance metric to use for kNN

Cosine distance is a term often used for the complement in positive space, that is: ${\displaystyle D_{C}(A,B)=1-S_{C}(A,B)} D_{C}(A,B)=1-S_{C}(A,B)$. It is important to note, however, that this is ...
1
vote
2answers
190 views

Conditions on a legitimate distance measure for clustering

Why does it seem unimportant to use a proper distance metric for clustering, i.e. (i) positive, (ii) zero iff the 2 operands are equal, and (iii) verifying the triangle inequality? I'm thinking in ...
0
votes
1answer
473 views

Does it make sense to cluster based on Euclidean distances between rows of a cosine matrix?

I calculated the Cosine distances for binary data and got the relations between different variables. I need to cluster them. I tried passing the cosine matrix directly to the (clustering) function ...
1
vote
0answers
1k views

How to combine Euclidean and Cosine distance?

EDIT (No duplicate of Converting similarity matrix to (euclidean) distance matrix): This question is centered on asking how to combine values from Euclidean and Cosine distances obtained from not-...
2
votes
0answers
686 views

Similarity metric for 2 sets of vectors

I'm trying to determine the similarity between two sentences. I have vectors for each word in a corpus, and using cosine distance of the two vectors, I can get quite a good "similarity" score ...
2
votes
0answers
587 views

Cosine similarity between document of few tweets and document of thousands of tweets

I collected a corpus of $n$ tweets (few thousand) during a 48-period. The tweets were all collected based on a set of search terms. The tweets were published by $a$ authors, with $a \leq n$. Let's ...
3
votes
2answers
10k views

TF-IDF versus Cosine Similarity in Document Search

I'm wondering if anyone can help me out or point out some resources to learn more about TF-IDF and document search. I'm trying to implement a basic document search and am trying to better understand ...
27
votes
2answers
22k views

Is cosine similarity identical to l2-normalized euclidean distance?

Identical meaning, that it will produce identical results for a similarity ranking between a vector u and a set of vectors V. I have a vector space model which has distance measure (euclidean ...
12
votes
1answer
5k views

Automatic keyword extraction: using cosine similarities as features

I've got a document-term matrix $M$, and now I would like to extract keywords for each documents with a supervised learning method (SVM, Naive Bayes, ...). In this model, I already use Tf-idf, Pos tag,...
1
vote
1answer
3k views

A question on cosine similarity & k-means

I used the following code to perform clustering of a dataset in R. distMatrix1 <- dist(sample2, method="cosine") km<-kmeans(distMatrix1,3) I have got some ...
1
vote
1answer
375 views

Metric for residuals in spherical K-means

I am attempting to use the bag-of-words approach to examine a large text data set. I am experimenting with using spherical K-means to cluster either documents or terms with respect to the other. I ...
1
vote
0answers
81 views

distances on a hypershere

I want to assess distances between pairs of high-dimensional vectors (~1500 features). My vectors have been normalized by their L2 norms, so they all have unit length and point to the surface of a ...
1
vote
0answers
90 views

TF-IDF vector contents when computing cosine similarity for document search

Say you're trying to find the most similar document in a corpus to a given search query. I've seen some examples create TF-IDF vectors that are the length of the given query, and some create TF-IDF ...
1
vote
0answers
1k views

Which SVD matrix do we use for cosine similarity

In Latent Semantic Analysis, we get 3 matrices from the singular value decomposition (SVD), but I am confused - which matrix do we use for cosine similarity?
0
votes
1answer
132 views

Why do two identical feature vectors (distance score 0) get different labels in DBSCAN?

I have two identical feature vectors. They have a distance score of 0. I perform DBSCAN Clustering (using sci-kit) and they get different labels. Is this expected behaviour?
1
vote
1answer
3k views

How can I calculate cosine distance with multiple feature vectors and weigh them?

I have a dataset of text documents and I'm calculating pairwise cosine distances among them. For each document I have a bag of words vector, a vector built from entities extracted from the document, ...