# Questions tagged [cosine-distance]

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

34 questions
Filter by
Sorted by
Tagged with
20k 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 ...
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,...
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 ...
11k 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 Kmeans clustering. However, the standard Kmeans clustering package (from Sklearn package) uses ...
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: ...
131 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 ...
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 ...
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 ...
3k 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?
40 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,...
579 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 ...
651 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 ...
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 ...
370 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 ...
621 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. ...
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 ...
2k 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, ...
15 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 ...
126 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 ...
536 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 ...
172 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 ...
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 ...
179 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 ...
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-...
78 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 ...
89 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 ...
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?
458 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 ...
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 ...
26 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. ...
7 views

### What features or architecture for a text answering system?

From this dataset with paragraphs, questions about these paragraphs and answers from these paragraphs, when there exists, I'm trying to predict the sentence where there is an answer. After ...
76 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 ...