All Questions
Tagged with euclidean-distance vector
37
questions
41
votes
4
answers
35k
views
Vector Space Model: Cosine Similarity vs Euclidean Distance
I have corpora of classified text. From these I create vectors. Each vector corresponds to one document. Vector components are word weights in this document computed as TFIDF values. Next I build a ...
35
votes
5
answers
109k
views
python numpy euclidean distance calculation between matrices of row vectors
I am new to Numpy and I would like to ask you how to calculate euclidean distance between points stored in a vector.
Let's assume that we have a numpy.array each row is a vector and a single numpy....
19
votes
3
answers
30k
views
Calculate Euclidean distance between 4-dimensional vectors
Let's say I have two 4-dimensional vectors (i.e. a and b) as follows:
a = {a1, a2, a3, a4}
b= {b1, b2, b3, b4}
How do I compute the Euclidean distance between these vectors?
12
votes
3
answers
25k
views
OpenCV euclidean distance between two vectors
I want to calculate the euclidean distance between two vectors (or two Matrx rows, doesn't matter). Is there a good function for that in OpenCV?
11
votes
3
answers
10k
views
How to get cosine distance between two vectors in postgres?
I am wondering if there is a way to get cosine distance of two vectors in postgres.
For storing vectors I am using CUBE data type.
Below is my table definition:
test=# \d vectors ...
4
votes
1
answer
3k
views
How to find the closest corresponding vectors between two coordinate matrices?
I have the following problem in Python I need to solve:
Given two coordinate matrices (NumPy ndarrays) A and B, find for all coordinate vectors a in A the corresponding coordinate vectors b in B, ...
2
votes
2
answers
1k
views
Euclidean distance or cosine similarity between columns with vectors in PySpark
I have a Spark dataframe in the following form:
> df1
+---------------+----------------+
| vector1| vector2|
+---------------+----------------+
|[[0.9,0.5,0.2]]| [[0.1,0.3,0.2]]|
|[...
2
votes
1
answer
438
views
Calculating two dimensions Euclidean distance and adding it as a column in the data
I need to create a variable that measures distance from APP.
The center of APP is at the coordinates 1440000 east, 12160000 north.
I need to make a new column calculating the euclidean distance ...
2
votes
1
answer
980
views
R: distance between point and line in n-dimensions
I'd like to calculate the distance between a point and a line in any number (i.e., n) of dimensions.
An excellent example for 2- and 3- dimensions is found here.
Is there a way to generalize this ...
1
vote
2
answers
194
views
MATLAB short way to find closest vector?
In my application, I need to find the "closest" (minimum Euclidean distance vector) to an input vector, among a set of vectors (i.e. a matrix)
Therefore every single time I have to do this :
...
1
vote
2
answers
189
views
Vector deltas and moving in unknown areas
I was in need of a little math help that I can't seem to find the answer to, any links to documentation would be greatly appreciated.
Heres my situation, I have no idea where I am in this maze, but I ...
1
vote
1
answer
643
views
How to generate random uniformly distributed vectors of euclidian length of one?
I am trying to randomly generate uniformly distributed vectors, which are of Euclidian length of 1. By uniformly distributed I mean that each entry (coordinate) of the vectors is uniformly distributed....
1
vote
3
answers
3k
views
Distance between multiple vectors
I have two sets of three-dimensional unit-vectors that I would like to get a measure of how similar they are. My current method is to manually calculate the euclidean norm of their difference.
An ...
1
vote
3
answers
3k
views
Calculate mean euclidean distance of multiple columns dataframe r
I have a dataframe that looks like this:
df <- data.frame(text = c("text1", "text2", "text3"),
a = c(1,2,3),
b = c(2,4,6),
c = c(3,6,9))
df
For each row I ...
1
vote
1
answer
1k
views
Calculate euclidean distance between multiple vectors in R
I'm trying to calculate the euclidean distances between one vector on the one hand and multiple vectors on the other hand using R.
So far, I've been following this documentation https://cran.r-project....
1
vote
2
answers
565
views
distance measure used to calculate k nearest neighbour
I am reading about k nearest neighbour, and the distance measure given in the example is as below.
It says Ri is the range of the i-th component. I am confused about which distance measure is used ...
1
vote
3
answers
697
views
how to compute the original vector from a distance matrix?
I have a small question about vector and matrix.
Suppose a vector V = {v1, v2, ..., vn}. I generate a n-by-n distance matrix M defined as:
M_ij = | v_i - v_j | such that i,j belong to [1, n].
That ...
1
vote
1
answer
21
views
Euclidean Distance between two vectors in two columns in spark data frme
I am trying to get euclidean distance between two vectors, in different columns in a spark dataframe. i need this operation done on spark. i have spend a lot of time trying to do this, but can't ...
1
vote
1
answer
559
views
Calculate distance between vectors from different Spark dataframes
I have two Spark dataframes:
> df1
+--------+-----------------------------+
| word | init_vec|
+--------+-----------------------------+
| venus |[-0.235, -0.060, -0.609, ...]|...
1
vote
1
answer
105
views
How to manipulate matrix addition and multiplication for Euclidean distance computation?
I have the following:
A = [1 2 3; 4 5 6; 7 8 9];
B = [10 11 12; 13 14 15];
[N1, D1] = size(A);
[N2, D2] = size(B);
A_sq = sum(A.^2, 2);
B_sq = sum(B.^2, 2)';
D = A_sq(:,ones(1,N2)) + B_sq(ones(1,...
0
votes
2
answers
82
views
How do I build a matrix using two vectors?
So I need to build a matrix of x and y coordinates. I have the x stored in one matrix called vx=0:6000; and y stored in Vy=repmat(300,1,6000);.
Values in x are 0,1,2,...,5999,6000.
Values in y are ...
0
votes
1
answer
11k
views
Euclidean Distance between 2 Vectors Implementation
I working through a few exercises from an academic programing book. The task is to implement 2 vectors and calculate the Euclidean distance between thereof. No this is not Home Work, rather self ...
0
votes
1
answer
4k
views
how to calculate Euclidean distance between all rows of a data frame and the last row in r
I have a data frame and would like to calculate the Euclidean distance between all rows and the last row and add the distance value as a new column to data frame using distance function.
Do you have ...
0
votes
1
answer
450
views
Weighted Euclidean Distance while Merging Feature Vectors?
I have two groups of features (describing an image, in a machine learning context). The first group A, consisting of 3 features, and group B consisting of 15 features.
A = [f1, f2, f3]
B = [f4, f5, ..,...
0
votes
1
answer
2k
views
MATLAB: Computing euclidean distance in an efficient way?
What I am currently doing is computing the euclidean distance between all elements in a vector (the elements are pixel locations in a 2D image) to see if the elements are close to each other. I create ...
0
votes
1
answer
38
views
assign two adjacent elements in pairwise to compute euclidian, retain stored distance
Purpose
Separate x, y, to calculate distance between points, using euclidean function
Problem 1
Assign x to first, third, firth, etc element values from moves vector. Assign y to second, fourth, sixth,...
0
votes
1
answer
160
views
How to go from a vector to a similarity matrix?
I would like to reconstruct a similarity matrix between two vectors from a vector containing the similarity between each pair of elements in the two vectors. Does anyone know how I could do it?
To ...
0
votes
1
answer
3k
views
Euclidean Distance of two vectors with different length
I have a code for calculating euclidean distance like this :
for(int j=0;j<inputdimension;j++){
distance += Math.pow((vector1[j] - vector2.get(j)), 2);
}
and i've an example of data ...
0
votes
1
answer
121
views
How to speedup my Libsvm vector to std::vector<float> conversion?
Introduction
I have a libsvm vector of the form:
{i_1:v_1; i_2:v_2;...; i_n:v_n}
Where i_j:v_j represent respectively the index and the value. If the value is null then it wont be given any index.
...
0
votes
1
answer
482
views
What distances measures perform well on content-based Recommendation Systems?
I want to implement a content based recommendation system that provides a list of recommended books based on user input.
I`ll be using TF-IDF to determine how important a word is to a given book and ...
0
votes
1
answer
99
views
Create n-dimensional random Point given Euclidean Distance
Given a point (p) and a Euclidean Distance (d), generate a random point (m) such that the Euclidean Distance between p and m is d.
This is easily to visualise and in 2D where the result set is just a ...
0
votes
0
answers
68
views
Is there a way to calculate Euclidean distance of two vectors by KMeans(BigQueryML)?
Given a table or dataset that holds data for two fields namely V_1 and V_2 and Use Euclidean distance as the distance type to measure distance between the given vectors
(https://i.stack.imgur.com/...
0
votes
0
answers
155
views
How can I get the Feature vector value?
I'm doing some project to detect images with a few descriptor and calculate its similarity measure. In this case, I'm using the euclidean distance and I didnt know how to retrieve the feature vector ...
0
votes
0
answers
187
views
How can I visualize the relationship (distance metrics) between multiple vectors?
I want to calculate the distance between multiple (approx. six) vectors in Python and subsequently I want to visualize the results since the numbers alone do not adequately represent the general ...
0
votes
1
answer
19
views
Pairwise Euclidean distance in DolphinDB
I have a matrix that represents a group of column vectors in DolphinDB. Each row is regarded as a component of the vector and each column is regarded as a column vector.
For example, the following 3*...
0
votes
2
answers
718
views
How to measure the length of a 2-dimensional path in separate steps
I am a newbie in python. I am stuck by finding the length of a path in 2d. I have no idea what I'm doing wrong. Please help!
import math
vector1 = v1
vector2 = v2
def length (v):
""" Length of a ...
-2
votes
1
answer
51
views
How to create spaces in a textbox?
I have a vb net program to take a binary value in the image. This syntax produces
111110
on textbox3.text. I want no spaces at textbox3.text
1 1 1 1 1 0
Dim x, y As Integer
Dim ...