euclidean-distance

How to calculate distance from a player to a dynamic collision point

How to calculate distance from a player to a dynamic collision point Question: I’m trying to create sensors for a car to keep track of the distances from the car to the borders of the track. My goal is to have 5 sensors (see image below) and use them to train a machine learning algorithm. …

Total answers: 1

Calculate Distance Metric between Homomorphic Encrypted Vectors

Calculate Distance Metric between Homomorphic Encrypted Vectors Question: Is there a way to calculate a distance metric (euclidean or cosine similarity or manhattan) between two homomorphically encrypted vectors? Specifically, I’m looking to generate embeddings of documents (using a transformer), homomorphically encrypting those embeddings, and wanting to calculate a distance metric between embeddings to obtain document …

Total answers: 1

Calculating smallest within trio distance

Calculating smallest within trio distance Question: 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 0.059520 0.053307 0.887173 3 0.091049 0.342226 0.566725 3 0.119295 0.414376 0.466329 … … … … … Basically, I …

Total answers: 1

Finding squared distances beteen n points to m points in numpy

Finding squared distances beteen n points to m points in numpy Question: I have 2 numpy arrays (say X and Y) which each row represents a point vector. I would like to find the squared euclidean distances (will call this ‘dist’) between each point in X to each point in Y. I would like the …

Total answers: 2

Euclidean distance with weights

Euclidean distance with weights Question: I am currently using SciPy to calculate the euclidean distance dis = scipy.spatial.distance.euclidean(A,B) where; A, B are 5-dimension bit vectors. It works fine now, but if I add weights for each dimension then, is it still possible to use scipy? What I have now: sqrt((a1-b1)^2 + (a2-b2)^2 +…+ (a5-b5)^2) What …

Total answers: 4

python numpy euclidean distance calculation between matrices of row vectors

python numpy euclidean distance calculation between matrices of row vectors Question: 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.array. I would like to know …

Total answers: 5

Minimum Euclidean distance between points in two different Numpy arrays, not within

Minimum Euclidean distance between points in two different Numpy arrays, not within Question: I have two arrays of x–y coordinates, and I would like to find the minimum Euclidean distance between each point in one array with all the points in the other array. The arrays are not necessarily the same size. For example: xy1=numpy.array( …

Total answers: 9

How can the Euclidean distance be calculated with NumPy?

How can the Euclidean distance be calculated with NumPy? Question: I have two points in 3D space: a = (ax, ay, az) b = (bx, by, bz) I want to calculate the distance between them: dist = sqrt((ax-bx)^2 + (ay-by)^2 + (az-bz)^2) How do I do this with NumPy? I have: import numpy a = …

Total answers: 26