Questions tagged [euclidean-distance]

the Euclidean distance or Euclidean metric is the "ordinary" distance between two points that one would measure with a ruler, and is given by the Pythagorean formula.

In mathematics, the Euclidean distance or Euclidean metric is the "ordinary" distance between two points that one would measure with a ruler, and is given by the Pythagorean formula. By using this formula as distance, Euclidean space (or even any inner product space) becomes a metric space. The associated norm is called the Euclidean norm.

http://en.wikipedia.org/wiki/Euclidean_distance

941 questions
-1
votes
1 answer

extract every two elements in matrix row in r in sequence to calculate euclidean distance

How to extract every two elements in sequence in a matrix and return the result as a matrix so that I could feed the answer in a formula for calculation: For example, I have a one row matrix with 6 columns: [,1][,2][,3][,4][,5][,6] [1,] 2 1 …
-1
votes
3 answers

How to calculate euclidian distance within group in R

If I have a dataframe like this: ID GroupID X Y 1 a 772.7778 226.5 1 a 806.5645 35.3871 1 a 925.5714 300.9286 1 b 708.0909 165.5455 1 b 630.8235 167.4118 2 a 555.3333 151.875 2 a 732.8947…
coco
  • 871
  • 1
  • 7
  • 15
-1
votes
1 answer

Fast distance calculation in R

I'm trying to calculate the 1) Euclidean distance, and 2) Mahalanobis distance for a set of matricies in r. I've been doing it as such: v1 <- structure(c(0.508, 0.454, 0, 2.156, 0.468, 0.488, 0.682, 1, 1.832, 0.44, 0.928, 0.358, 1,…
Zafar
  • 1,897
  • 15
  • 33
-1
votes
1 answer

Two text files with 1,096 individual decimal numbers - subtract each of the elements and total the sum

I have two text files that contain 1,096 values (these are features extracted from a neural network layer). I want to take the first element of the the first text file and subtract it from the first element of the second text file and so on through…
BLogger48
  • 21
  • 4
-1
votes
2 answers

Creating distance matrix in R for a matrix in a higher dimensional space

I have created an euclidean distance matrix using dist() function in R. Below is my R script. As the dimensions of matrix would be 16809 * 16809 while running this script in R I got the error message: Error: cannot allocate vector of size 1.1 Gb…
seema aswani
  • 177
  • 1
  • 14
-1
votes
1 answer

K-Nearest Neighbor Implementation for Strings (Unstructured data) in Java

I'm looking for implementation for K-Nearest Neighbor algorithm in Java for unstructured data. I found many implementation for numeric data, however how I can implement it and calculate the Euclidean Distance for text (Strings). Here is one example…
F. Fo
  • 123
  • 6
  • 18
-1
votes
2 answers

How to calculate distance between several points simultaneously with Euclidean Distance

I know how to get distance between points, however I want to get distance between 2 objects where each object has several points. (See illustration below.) I want to calculate distance between object A and object B based on their points with…
Rex
  • 13
  • 1
  • 4
-1
votes
1 answer

Euclidean Distance vb net

I have a program that I created, the result is not appropriate, I want to do multiplication between rows of numbers -1, -1, -1 and 1,2, -1 -1x1 = -1 -1x2 = -2 -1x-1 = 1 then the results are summed (-1) + (- 2) + 1 = -2 please solution, for…
-1
votes
1 answer

Item Based Similarity Metric

I am using Mahout Apache to write an item based recommender (based on similar item ratings by users) and I was wondering which of the following two similarity metrics would be the best to use: Pearson, Spearman, Euclidean, Tanimoto and Loglikelihood
tlauer
  • 558
  • 2
  • 8
  • 22
-1
votes
1 answer

Recommender Systems: Does using Singular Value Decomposition rule out the possibility of using Euclidean Distance as way of measuring similarity?

I'm learning about recommender systems and learning about different similarity algorithms. Euclidean distance would change as the scale of the objects being compared changes. In that case, would SVD (Singular Value Decomposition) and Euclidean…
covfefe
  • 2,485
  • 8
  • 47
  • 77
-1
votes
1 answer

Distance calculation for coordinates called from a file(Python2.7)

I'm trying to read coordinates from a file and find distance between each two respective atoms in the file. I want to have the calculated distance in one column and the respective atom names in the other. 1 Br1 0 Br x,y,z 1.195 7.005 10.004 2 Br2 0…
Prelude
  • 151
  • 1
  • 10
-1
votes
1 answer

Euclidean distance between two arrays, undeclared identifier

I have this code in calculating euclidean distance. But, I don't know why I'm having this error. array1 and array2 undeclared . double dist(double x[4] array1, double y[4] array2) { double Sum; double distance; for(int…
pingboo23
  • 137
  • 1
  • 3
  • 15
-1
votes
3 answers

how to define a pow2 macro in C++

I want to have definition for pow2C as follows. But my compiler shows it (__tmpDouble__) is already defined. Please help me define it. #ifndef pow2C double __tmpDouble__; #define pow2C(a) ((__tmpDouble__=(a))*(__tmpDouble__)) #endif . . . inline…
remo
  • 880
  • 2
  • 14
  • 32
-2
votes
1 answer

Calculating smallest within trio distance

I have a pandas dataframe similar to the one below: Output var1 var2 var3 1 0.487981 0.297929 0.214090 1 0.945660 0.031666 0.022674 2 0.119845 0.828661 0.051495 2 0.095186 0.852232 0.052582 3 …
-2
votes
1 answer

How do I find the euclidean distance between two lists without using numpy or zip?

​​How do I find the euclidean distance between two lists without using either the numpy or the zip feature? Furthermore, the lists are of equal length, but the length of the lists are not defined. For example: ex 1. list_1 = [0, 5, 6] list_2 = [1,…
1 2 3
62
63