Questions tagged [distance-matrix]

A distance matrix is a matrix containing the pairwise distances between the elements of a set. The "distance" may rely on the concept of metric.

The distance matrix for an N-elements set is a NxN matrix in which entry (i,j) contains the distance between items i and j.
The distance might be related to the concept of metric (e.g. Euclidean distance, Mahlanobis distance, and so on) but there are also non-metric distance matrices: an adjacency matrix is an example of such non-metric distance matrices.

174 questions
1
vote
0 answers

How can I get the coefficients output when doing a PERMANOVA with adonis?

The broader question I am interested in is how to interpret differently doing a PERMANOVA on an species-abundance table vs. on its distance matrix (I use bray-curtis). On the R documentation on the adonis function…
Elsa
  • 159
  • 1
  • 11
1
vote
0 answers

-[object Object]- error on Google Distance Matrix - Android and iOS

Suddenly, without any code changes, my apps stop working. It’s taxi system with driver/passenger apps. Now, when passenger choose start point and destination point - instead of calculation of route I get: Unknown error -[object Object]- Billing…
Eager2Learn
  • 153
  • 4
  • 19
1
vote
1 answer

Reading an upper triangular distance matrix and generating a dendrogram in R

My problem (today) is as follows: I have an upper diagonal distance matrix in a file ("dist.dis") in text format (generated by a third-part program), which I want to read into R to compute a cluster analysis and generate a dendrogram: 0.36364 …
maurobio
  • 1,480
  • 4
  • 27
  • 38
1
vote
1 answer

returned value from a callback function

I am having some trouble while getting the returned value by the callback function ("dist" = undefined).....I've tried to get the value so many times but still undefined. However, I can get it from the console....Please Some Body can…
1
vote
1 answer

How can I construct a distance or dissimilarity matrix?

I have a df as follows: 0 111155555511111116666611111111 1 555555111111111116666611222222 2 221111114444411111111777777777 3 111111116666666661111111111111 ....... 1000 114444111111111111555555111111 I am calculating the distance…
Sakib Shahriar
  • 121
  • 1
  • 12
1
vote
2 answers

Clustering and Distance/Dissimilarity Matrrix based on String/Integer sequences in Python

I have customer's data based on his stay in the shop. The shop has 4 zones; zone 1,2,3 and 4. Now every 2 minutes, I get his reading as 10 numbers based on which zone he is in.…
1
vote
0 answers

How to cluster elements based on minimum distance threshold in matrix using R?

I have distance matrix mdist (187x187 items). I need to have clusters based on minimum for each item. I've counted those minimae: mins = list() for (i in (1:nrow(mdist))) { md = min(mdist[i,-c(i)]) mins <- rbind.data.frame(mins, list(id=i,…
Peter.k
  • 1,475
  • 23
  • 40
1
vote
1 answer

How to keep row names for hirarchical clustering on imported csv files

I would like to produce a hirarchical clustering analysis of data imported from .csv file into R. I'm having trouble retaining the first column of row names, so my dendrogram tips end up with no names, which is useless for downstream analyses and…
Will Hamilton
  • 357
  • 2
  • 17
1
vote
1 answer

How can I cluster data using a distance matrix with the ELKI library?

I have a distance matrix and I want to use that distance matrix when clustering my data. I've read the ELKI documentation and it states that I can overwrite the distance method when extending the AbstractNumberVectorDistanceFunction class. The…
Vahe Karapetyan
  • 149
  • 2
  • 9
1
vote
1 answer

How to cluster my data with a custom distance matrix using smile library's CLARANS method

I want cluster my data with a custom distance matrix rather than the built-in algorithms (i.e Euclidean). And there seems to be no clear way of doing it. I've tried to add some of my code to the demos in the Smile project. Also tried to do it with…
1
vote
1 answer

Calculating a 2d distance matrix from a Google DistanceMatrix response in Java

I am trying to solve the Travelling Salesman Problem and Vehicle routing problem with the Google Or tools library, in the tutorial found here, they use a distance Matrix whose i, j entry is the distance from location i to location j in miles, where…
Astonio
  • 635
  • 2
  • 8
  • 21
1
vote
0 answers

facing with an error: "RuntimeWarning: invalid value encountered in sqrt" while calculating distance-matrix

I have generated a matrix randomly with:mtx=numpy.random.rand(100,3) then I tried to reduce the dimension of matrix to 2 using: from sklearn.manifold import TSNE newMTX=TSNE(2,method='barnes_hut') After that I wanted to calculate the…
1
vote
0 answers

Compute distance matrix for sequences of unequal lengths

I have a multiple sequences (with unequal lengths) of the form: series = [ [1, 2, 5, 6, 9, 1], [2, 6, 1, 4, 5], [3, 5, 6, 7, 1, 4, 8, 7, 9], [4, 3, 2, 1], ... [2, 9, 7, 6, 5] ] …
1
vote
1 answer

How to calculate a distance matrix from a diagonal line?

Consider we have a data frame called Pred. It consists of 1 user per row. The users are specified by their unique userID. Users can be grouped by the cluster they belong to. Users reported their Confidence and Challenge for a task, this…
Sandy
  • 1,100
  • 10
  • 18
1
vote
0 answers

How to create a Jaccard Distance Matrix of transactional data?

I am new to programming and this is my first question posted so please have patience with me :) I am trying to create a distance matrix from transactional data so I can do clustering and analyze what products are bought together. I have used…