Questions tagged [pairwise-distance]
32 questions
0
votes
0 answers
Passing sparse distance matrix to AgglomerativeClustering is giving TypeError
I was getting MemoryError when I imported 100,000 documents to pairwise_distances function. For this reason, I sparsely calculated the distance matrix piece by piece and combined it finally. But AgglomerativeClustering does not take sparse matrix…

Salihcan
- 91
- 13
0
votes
1 answer
Torch custom pairwise distance
i'm working on big distance matrix (10-80k row ; 3k cols) and i want to get custom pairwise distance on that matrix ; and do it fast.
I have trying with armadillo but with huge data it still "slow"
I try with torch with cuda acceleration and with…

Ludo Vic
- 17
- 7
0
votes
0 answers
Gurobi/python euclidean/manhattan distance calculations inside of a constraint, addConstr(...)
Is it possible to use the sklearn pairwise_distances function inside an addConstr(...) for computing the distance between 2 D-dimensional points in the constraint? I'd like to do something like this:
for i in range(N):
for j in range(N):
…

HKAY
- 13
- 3
0
votes
1 answer
Pairwise Mahalanobis Distance Between Multiple Independent Variables and a Dependent Variable With Three Classes in R
Issue
I'm having some trouble calculating the Mahalanobis Distance between three classes of the independent variable Country.
My aim is to calculate the Mahalanobis distance among dolphin whistle acoustic parameters measured from a spectrogram taken…

Alice Hobbs
- 1,021
- 1
- 15
- 31
0
votes
1 answer
Creating a pairwise similarity matrix of a list of words using Gensim Fasttext in python
I have a list of words, and I need to create a pairwise similarity matrix using the Fasttext word embedding. This is what I am currently doing:
from gensim.models import fasttext as ft
from sklearn.metrics import…

sato
- 768
- 1
- 9
- 30
0
votes
2 answers
Calculating pairwise overlap for multiple boolean columns in pandas dataframe
I have a pandas dataframe with multiple boolean columns. I would like to find the pairwise overlap between all these columns. The overlap should be something like the proportion of overlap between two columns excluding cases where both are zero.…

Ichta
- 278
- 4
- 15
0
votes
2 answers
How to create a pairwise DTW cost matrix?
I am trying to create a pairwise DTW (Dynamic Time Warping) matrix in python. I have the below code already, but it is incorrect somehow. My current output is a matrix full of infinity, which is incorrect. I cannot figure out what I am doing…

Blueboots
- 49
- 1
- 9
0
votes
0 answers
How can I calculate distances with points in a huge matrix, 70000 rows, 6 columns?
the matrix is about 70000 rows, 6 columns, the first two columns are x, y coordinates, the last four columns do not participate in calculation...
the code is
distances = sklearn.metrics.pairwise.pairwise_distances(polygon_centers[:, 0:2],…

hesheng huang
- 1
- 2
0
votes
2 answers
Alternate approach for pdist() from scipy in Julia?
My objective is to replicate the functionality of pdist() from SciPy in Julia.
I tried using Distances.jl package to perform pairwise computation of distance between observations. However, the results are not same as seen in the below mentioned…

Mohammad Saad
- 1,935
- 10
- 28
0
votes
1 answer
Calculating pairwise distances from external file
I have data in a text file of the following format:
t x y z
Pb 1.0000 1.5000 2.5000
Pb 1.1000 1.6000 2.6000
S 1.2000 1.4000 2.4000
I would like to be able to calculate pairwise distances for all of the coordinates I have, but somehow…

kalle
- 425
- 1
- 6
- 17
0
votes
0 answers
Java - Calculate all pairs positions distance of multi-vectors
Suppose I have 5 lists different lenths that contain positions (2D points). I need to calculate distances of all pairs of points possible between these 5 lists in order to filter the pairs that have distance smaller than a threshold, e.g., 10.
A…

Amateur
- 151
- 1
- 2
- 12
0
votes
1 answer
Maximum Distance of 2 sets of points with a 2-factor approximation
given a set of n points , i take k points randomly. I need to compute in the most efficient way the maximum distance of the k points from the n points with a 2-approx factor (exploiting in some way the triangular inequality).
A first idea I had was…

LeoPret
- 59
- 1
- 5
0
votes
2 answers
Anyone knows a more efficient way to run a pairwise comparison of hundreds of trajectories?
So I have two different files containing multiple trajectories in a squared map (512x512 pixels). Each file contains information about the spatial position of each particle within a track/trajectory (X and Y coordinates) and to which…

Paulo Caldas
- 93
- 8
0
votes
0 answers
Most efficient way of conditional pairwise row operations in a pandas DataFrame
I have a pandas DataFrame 'df' containing about 106 rows. Now I want to execute the following code:
c = []
for ind, a in df.iterrows():
for ind, b in df.iterrows():
if a.hit_id < b.hit_id and a.layer_id != b.layer_id :
…
0
votes
1 answer
Pairwise Similarity and Sorting Samples
The following is a problem from an assignment that I am trying to solve:
Visualization of similarity matrix. Represent every sample with a four-dimension vector (sepal length, sepal width, petal length, petal width). For every two samples, compute…

MatthewS
- 455
- 2
- 7
- 22