# Questions tagged [cosine-distance]

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

40 questions
Filter by
Sorted by
Tagged with
8 views

### Understanding distance correlation computation for Multivariate Data

The original question and answer is in this link : Understanding distance correlation computations Since I do not have enough reputation, I don't have the right to comment. This is the main reason why ...
1 vote
18 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 ...
• 177
152 views

### Cosine similarity for Categorical datasets?

Can I use Cosine similarity measure for estimating similarity/relationship between D1 and D2 (two categorical datasets)
• 41
1 vote
407 views

### Is $cos^n(x^2-y^2)$ a valid mercer kernel function?

How to show if $cos^n(x^2-y^2)$ is a valid mercer kernel function if $n$ is positive? For $cos(x^2-y^2)$ I would assume that: $cos(x^2-y^2) = sin(x^2)sin(y^2)+cos(x^2)cos(y^2)$ Is a valid mercer ...
1 vote
86 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 ...
• 21
1 vote
69 views

### How to find the list of nearest vectors if ony a vector is given?

I know there are many ways to compute similarity of two different non-zero vectors but is it possible to get a list of nearest vectors whose values are continous given a single continous vector. Lets ...
• 2,021
560 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
193 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 ...
• 11
144 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,...
• 53
211 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. ...
• 1
193 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 ...
• 143
33k 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 ...
• 255
8k 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 ...
• 213
2k 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)...
187 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 ...
• 171
1 vote
179 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 ...
1k 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 ...
• 21
312 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 ...
• 21
1 vote
1k 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. ...
• 121
1 vote
4k 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 ...
• 335
1 vote
403 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 ...
• 134
3k 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 ...
597 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
3k 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-...
• 143
7k 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?
• 81
1 vote
5k 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
514 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
167 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 ...
• 41
1 vote
109 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 ...
• 171
1 vote
2k 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?
7k 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,...
• 295
45k 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 ...
• 453
663 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 ...
• 713
14k 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 ...
• 171
976 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 ...
144 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?
• 17
22k 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 ...
• 3,545
10k 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: ...
• 171
1 vote