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
0
votes
0answers
6 views

How to validate collaborative filtering recommender system in r?

I have a project which I have to make a recommender system of BX Books dataset. I use cosine similarity as my algorithm. I came up with this script of R: ...
-1
votes
1answer
35 views

Word Embeddings with TFIDF vectorizer

I am a beginner in machine learning. I have a large corpus of texts, divided into thematic groups. I would like to get idf values for the whole corpus, and then apply it on each group before ...
0
votes
0answers
12 views

What information is encoded in embedding vector lengths?

I have started to investigate word2vec and related embedding strategies. The word2vec training loss is a function of cosine distance and not Euclidean distance. In fact I have been reading various ...
0
votes
0answers
16 views

What is the difference between row-wise and column-wise Z-score normalization?

I have a data set, each row represents a movie name, each column is a feature (such as genres), I want to perform cosine similarity to find out the similarity between each movie, before that I need to ...
0
votes
1answer
35 views

counter vector fit transform cosine similarity memory error

count_matrix = count.fit_transform(off_data3['bag_of_words']) I have count_matrix shape with count_matrix.shape (476147, 482824) ...
1
vote
1answer
245 views

memory error in matrix cosine_similarity

I have (20905040, 7) of a dataset to recommend 10 different product to the user it could be larger than that but anyway I got memory error when processing the ...
1
vote
1answer
85 views

Elbow method for cosine distance

I have clustered vectors by cosine distance using nltk clusterer. If I understand correctly, Y axis for elbow method in euclidian distance would be the sum of every distance (squared) between centroid ...
0
votes
1answer
12 views

Document matching with more priority to certain features than others

I am working on recommendation systems wherein I need to match the similarity of 2 users. Now, I know that I can use Tfidf vectorizer to calculate the the cosine similarity score between them. But, ...
2
votes
1answer
456 views

Calculating cosine similarity between 3D arrays using Python

I have two matrices with multiple columns and three rows each. I calculated the cosine similarity (sklearn) but it gives the result as a matrix. How can I obtain one single value? The matrices are the ...
1
vote
1answer
23 views

Checking TF-IDF Results

I am working with TF-IDF and cosine similarity to do document comparisons and given a document, which document in the data is the most similar. However, sometimes it returns a high similarity between ...
2
votes
1answer
86 views

word2vec word embeddings creates very distant vectors, closest similarity is still very far

I started using gensim's FastText to create word embeddings on a large corpus of a specialized domain (after finding that existing open source embeddings are not performing well on this domain), ...
1
vote
1answer
490 views

Hierarchical clustering with precomputed cosine similarity matrix using scikit learn produces error

We want to use cosine similarity with hierarchical clustering and we have cosine similarities already calculated. In the sklearn.cluster.AgglomerativeClustering documentation it says: A distance ...
2
votes
0answers
208 views

Cosine similarity with arrays contaning NaN

I am trying to calculate a cosine similarity using Python in order to find similar users basing on ratings they have given to movies. As it can be expected there are a lot of NaN values. I am using ...
0
votes
2answers
1k views

how to create word2vec for phrases and then calculate cosine similarity

I have just started using word2vec and I have no idea how to create vectors (using word2vec) of two lists, each containing set of words and phrases and then how to calculate cosine similarity between ...
2
votes
3answers
47 views

Match a two items from two different receipts

I have two different invoices or receipts. One is a Purchase order one is something like a receipt(acknowledgement). Suppose I have ordered(PO) Wine: White Wine Red Wine Rose Wine And I receive ...
2
votes
1answer
23 views

When I would use a specific similarity coefficient over another?

Like using Jaccards over Dice. I want real examples, of when I would prefer to use Jaccards, Dice, Cosine or any other similarity coefficient.
2
votes
1answer
345 views

cosine similarity between items (purchase data) and normalisation

I'm using IndexedRowMatrix which represents the products's user purchase behaviours and in order to build product recommendations, I use cosine similarity to calculate similarities between products. ...
1
vote
0answers
20 views

Best way to find dissimilarity in a 6x2 DataFrame?

I'm new to data science and am currently learning different techniques that I can do with Python. Currently, I'm trying it out with Spotify's API for my own playlists. The goal is to find the most ...
1
vote
0answers
23 views

Can I sum up feature vectors of a user‘s collection?

I want to find items that are similar to items users already have in their collection. Every item has attributes, so I created feature vectors where every element of the vector represents an attribute ...
2
votes
3answers
265 views

clustering 2-dimensional euclidean vectors - appropriate dissimilarity measure

I've got a set of approx. 50 000 2-dimensional euclidean vectors which are connected with 20 groups, i.e. each group has approx. 2500 2-dimensional euclidean vectors. My data includes endpoints ...
2
votes
0answers
801 views

Clustering with cosine similarity with specific threshold (in Python)

Given : 1, either given the origin data matrix X , such as X = [[1,1,1,1],[1,1,-1,-1],[1,1,1,-1]] or given the cosine similarity matrix of the original data X , ...
2
votes
1answer
1k views

How to find similar time series?

I've got a collection of yearly data (one value per year per category), and I'd like to find series that are most similar to one another. Example data is here. I don't know much about data science, ...
6
votes
1answer
11k views

cosine_similarity returns matrix instead of single value

I am using below code to compute cosine similarity between the 2 vectors. It returns a matrix instead of a single value 0.8660254. [[ 1. 0.8660254] [...
6
votes
2answers
6k views

Can I use cosine similarity as a distance metric in a KNN algorithm

Most discussions of KNN mention Euclidean,Manhattan and Hamming distances, but they dont mention cosine similarity metric. Is there a reason for this?
2
votes
2answers
470 views

Confusion with cosine similarity

In information retrieval when we calculate the cosine similarity between the query features vector and the document features vector we penalize the unseen words in the query. Example if we have two ...
1
vote
1answer
3k views

Cosine similarity between query and document confusion

I am going through the Manning book for Information retrieval. Currently I am at the part about cosine similarity. One thing is not clear for me. Let's say that I have the tf idf vectors for the ...
0
votes
1answer
3k views

Create similarity matrix

I have a training set and a testing set of vectors. All the vectors are labeled. For each labeled vector in the testing set, there are 3 vectors in the training set with the same label. I'm using ...
1
vote
1answer
772 views

Computing Item-to-Item Similarity Using Cosine

I have a "User x Item" matrix as below: user item1 item2 item3 u1 2 0 3 u2 1 2 0 u3 4 3 1 u4 0 2 2 I want to computer the ...
1
vote
2answers
917 views

What techniques should I use to compare the similarity between a bunch of texts?

If I have a list of job postings stored as raw texts and I want to compare the similarity of all the job postings to a given resume, what techniques or algorithms should I use? I'm thinking of ...
4
votes
1answer
167 views

How should I evaluate writing quality to compare two articles(which article is better suited/written for a topic ) according to their content?

I am trying to come up with a platform which can Synthesize Quality Content among many articles found about some particular "topic" on the internet, the algorithm should be able to say recommend top ...
2
votes
0answers
295 views

Recommendation matrix as a product of User Similarity and Ratings

For both item-item and user-user collaborative filtering the recommendation matrix $Γ_{m x n}$, which is an (m x n) matrix, can be defined as: $$Γ(i,j)=r_{ij}$$ For user-user collaborative ...
12
votes
4answers
5k views

Alternatives to TF-IDF and Cosine Similarity when comparing documents of differing formats

I've been working on a small, personal project which takes a user's job skills and suggests the most ideal career for them based on those skills. I use a database of job listings to achieve this. At ...
2
votes
1answer
799 views

Is it possible to use Jaccard similarity instead of Cosine similarity in gensim document similarity?

I am using gensim library to compute similarity between documents but it only uses cosine similarity. I was wondering if there was a way to use jaccard similarity or any other similarity measure for ...
8
votes
1answer
13k views

Calculate cosine similarity in Apache Spark

I have a DataFrame with IDF of certain words computed. For example ...
8
votes
2answers
298 views

What should be the value of non-rated field when finding cosine similarity

I am working on a very basic book recommender system. I want to know what to do with the fields which aren't rated by the user when finding cosine similarity, should we ignore them and calculate only ...
3
votes
2answers
1k views

Word analysis in Python

I have a list of documents which look like this: ["Display is flickering"] ["Battery charger is broken"] ["Hard disk is making noises"] These text documents are ...
1
vote
0answers
541 views

Compute angle of vector in word2vec models

If I understand correctly, the most_similar function computes the cosine similarity of the vector with all other vectors and finds the closest one. The vectors ...
3
votes
3answers
5k views

How to find similarity/distance matrix with mixed Continuous and Categorical data?

Say I have a dataset like this: Hotel HasPool AvgPrice 1 1 $123 2 0 $234 3 1 $200 Currently I have broken down the ...
1
vote
2answers
147 views

Is Vector in Cosine Similarity the same as vector in Physics?

I'm new to Data Science. I'm trying to understand cosine similarity and it seems like the equation is about finding the distance between two vectors. From what I've Googled, a vector needs to have ...
1
vote
0answers
273 views

tf-idf clustering

I have over a million text documents that I would like to cluster. I used tf-idf modeling and term vector cosine for identifying similar documents in the corpus, which appeared to work well. Some ...
6
votes
1answer
6k views

Cosine Distance > 1 in scipy

I am working on a recommendation engine, and I have chosen to use SciPy's cosine distance as a way of comparing items. I have two vectors: ...