Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [distance]

Measure of distance between distributions or variables, such as Euclidean distance between points in n-space.

0
votes
0answers
15 views

Pearson correlation as distance metric

I have read that Pearson correlation is used as a distance metric for high dimensional data. Could someone please explain it intuitively, mathematically with reference as to why it is a good distance ...
0
votes
0answers
13 views

Is one-hot encoding and standardization of data equivalent to Gower's distance?

For clustering and other techniques for mixed data (numerical and categorical), Gower's distance is usually more preferred than Euclidean distance because the former computes distance differently for ...
1
vote
0answers
11 views

KL divergence between sample and true (multivariate normal) distribution

I was wondering, whether there is a possible interpretation of the KL-Divergence between sample and true distribution in terms of probabilities. E.g. given $P=\mathcal{N}\left(\mu,\Sigma\right)$ and $...
2
votes
1answer
30 views

$L_2$ norm of product of two vectors

Let's assume we have two matrices $A^{d\times 1}$ and $B^{1 \times e}$, and we define their product as $C^{d\times e}$. Assuming $A,B$ are real valued with all entries in $[-1,1]$. I can intuitively ...
0
votes
0answers
6 views

BGSS for non-euclidean distance matrices

How to compute BGSS without the concept of centroid or barycentre where only a distance matrix is available and not the original data points? For non-euclidean distances, TSS (total sum of squares) = ...
2
votes
1answer
31 views

Distance metric with characteristics of cosine and Manhattan

I'm working on a project where I want to find similarities between groups of events. So far I have expressed groups of events as vectors of event counts and computing similarities between them. I'm ...
0
votes
0answers
15 views

Class frequency comparison (exponential distribution)

I have two different sources of data and I would like to check if their class distributions are similar and how much. The first dataset ($D_1$) has 2M samples and the second ($D_2$) 6M. When I ...
2
votes
2answers
30 views

Localized distance function on sequential binary data

I am trying to find a good distance function for sequential data that is all binary. For now, I am using Edit distance however I have some more domain-specific knowledge that I would like to ...
0
votes
1answer
12 views

How bregman divergence gives optimal solution for cluster assignment?

Can somebody gives intuition behind Bregman divergences that how using it leads to optimal cluster representation? And why using ...
0
votes
1answer
22 views

Euclidean distances in spaces of different dimensions

A modest attempt to illustrate my question: Setup Consider a survey where you have to choose if you like to do an activity or not. You do this for a number of activities $A_1,...,A_8$. In addition, ...
-1
votes
1answer
19 views

How to cluster a (directional) dissimilarity matrix with both positive and negative values?

I may be thinking of this incorrectly but what would be the best way to cluster a dissimilarity measure that has direction? For example, if someone had condition A ...
0
votes
0answers
28 views

Is there any intuition behind the writing Jensen-Shannon divergence based on the entropy?

I know that Jensen-Shannon divergence between two distribution $P$ and $Q$ can be written as follow: $JS(P||Q) = H(\frac{P+Q}{2}) - \frac{H(P)}{2} - \frac{H(Q)}{2}$ But is there any intuition behind ...
2
votes
0answers
28 views

Computing Wassertein Distance

For two probability measures $\mu$ and $\nu$, the Wassertein Distance is defined as $$W_p (\mu , \nu) = \left[ \inf\limits_{\gamma \in \Gamma} |x-y|^p \, d\gamma (x,y) \right] ^{\frac{1}{p}} \, , $$ ...
0
votes
1answer
35 views

R: What is the distance function equivalent for this formula?

Hi I'm using an R package that calculates distance with this formula here, as.dist(1 - cor(df, use = "pa")) However I cannot seem to find an equivalent dist ...
0
votes
0answers
21 views

How to localize points from an incomplete distance matrix in R?

Suppose you have 3 shops and 2 supply units, and you only know the 6 pairwise (Euclidean, assuming 2D) distances between each shop and each supply unit, but not the pairwise distances between the ...
0
votes
0answers
3 views

Quick search based on similarity: logarithmic time

I have some objects $x\in X$ and a metric $s:X\times X\to\mathbb{R_{+}}$. For each $x$, there is a $y\in Y$. Note that $x$ and $y$ are highly structured and we cannot consider neural networks for ...
0
votes
0answers
8 views

Calculate association trends

I have time series dataset for 10 consecutive periods (i.e. T, T+1, T+2, ..., T+9). Moreover, I also have 100 term triplets in each time period. Each triplet contains 3 objects namely x, y and z. I ...
3
votes
1answer
58 views

Calculation of relative distance

I have 100 term triplets as shown in the below mentioned figure. Each triplet contains 3 objects namely x, y and z. I want to rank the triplets according to the following two properties. y should be ...
1
vote
1answer
73 views

Mahalanobis distance gives counterintuitive results [closed]

I have generated 100 sample time series, each 24 items long, and each with an exponential distribution with a different scale for each of the 24 time points. This is the scale parameter per time point:...
2
votes
1answer
49 views

Basic Hellinger Distance

One definition of Hellinger Distance is $$L_{H}: (1/2) E_{\theta}([\sqrt{\frac{f(x|\delta)}{f(x|\theta)}}-1])^{2}$$ My book has that for $x \sim N(\theta,1)$ $$L_{H}(\theta,\delta)=1-\exp(-(1/8)(\...
1
vote
0answers
55 views

Mahalanobis distance between 2 points doesn't work when covariance matrix has values close to 0

I am working on a project where I am trying to replicate a randomized experiment from an observational study data, using Mahalanobis distance matching to ensure that the control and treated groups are ...
2
votes
1answer
87 views

How can I order kmeans clusters?

I have a kmeans cluster object and I would like to order the clusters. Not the observations within the clusters, rather the clusters in order of each other. Is there a way of doing this? I found ...
0
votes
1answer
21 views

Kmeans results, is the cluster vector ordered by 'closeness"?

I ran kmeans in r with k = 20 centers and 7 scaled variables to cluster with on a data frame with n = 100K. Using dplyr group_by I was able to view summary data for each of the 20 clusters: the mean ...
-1
votes
1answer
72 views

How k-means computes cluster centroids differently for each distance metric?

K-means computes cluster centroids differently for each distance metric. I don't know why the way of computing the centroid is dependent of the distance measure. I don't know how we compute the ...
0
votes
0answers
14 views

Robust distance measure for correlated data

I read a paper in which the authors want to compare the overall predictive accuracy of various predictors on a set of variables by using the Mahalanobis-Distance. However the data is not even ...
3
votes
2answers
212 views
0
votes
1answer
21 views

Clustering by same random projection

I have $N$, $1024$-dimensional vectors. I want to cluster them by some similarity. Given the high dimensionality, standard metrics won't work. I tried a few Approximate Nearest Neighbor ...
1
vote
0answers
52 views

Compare KS test and Wasserstein distance or Earth mover's distance

Consider two sets of data points A and B. Both these data points are from mixture of unknown number of Gaussians. The mean of the Gaussians are little different for each set (there may have few ...
0
votes
0answers
16 views

Comparison of empirical discrete distributions. Pros and cons of different metrics?

I am trying to measure the dissimilarity between two empirical discrete distributions. I am aware of various distance metrics that could be used for this purpose such as Wasserstein, Bhattacharyya etc....
1
vote
0answers
18 views

Mean distance from the centre to any point in a sphere and a cylinder [closed]

What is the mean distance from the centre to any point within a sphere of radius r? What is the mean distance from the centre to any point within a cylinder of radius r and length l?
0
votes
0answers
39 views

How to quantify distance between 2 datasets?

I have a distribution $A$ (intent-to-treat population) and its subset $B \subset A$ (treated population). I learn a propensity model $P(x \in B)$ to predict treatment. Then I sample the intent-to-...
1
vote
0answers
48 views

Distance between angle distributions

I want to quantify the complexity of the street network of different cities. For each city I have the angle distribution of its streets. My hypothesis that the more complex the street network, the ...
0
votes
0answers
29 views

How to find Mahalanobis distance between an observation and a population with mixed data?

I have a dataset(let's call it as 'D') with multiple continuous, nominal and ordinal variables, as follows: continuous: Total sales as well as sales figures of some products by customers nominal: ...
0
votes
0answers
31 views

Comparing distances evaluated on different vector spaces

We have a dataset of I items who have been measured over two different sets of features A, with cardinality N, and B with cardinality M, and N > M. We would like to know in which feature space the ...
3
votes
3answers
205 views

Probability that an observation comes from population A or B?

I'm a web developer looking into some basic statistics -- pardon me if I am using the wrong jargon. :) Considering that: I have 2 populations (A and B; each have about 10,000 observations) For each ...
0
votes
1answer
54 views

Hellinger distance for two shifted log-normal distributions

If I am not mistaken, Hellinger distance between P and Q is generally given by: $$ H^2(P, Q) = \frac12 \int \left( \sqrt{dP} - \sqrt{dQ} \right)^2 .$$ If P and Q, however, are two differently ...
0
votes
0answers
15 views

How to Measure Similarity to Ground Truth? (Measuring Similarity with Features of Different Scales/Units)

I am trying to reproduce a set of ground truth data [t_start | t_end | theta_start | theta_end] (blue) A plot of my ground truth data would show a scatter of lines along the time and angular axes....
2
votes
1answer
96 views

Choosing appropriate distance metric and algorithm for clustering for any given dataset

I have been looking for an answer/guidance/pointer to this question of mine for a while. After going through many (100s actually) posts and articles, I finally found this question, where this response ...
2
votes
1answer
43 views

Distribution of distance of N-1 gamma distributed iid random variables from minimum

I have the minimum value of N iid random variables that are gamma-distributed. The parameters of the gamma distribution are known. What would be the distribution of the distance of the remaining N - 1 ...
0
votes
1answer
28 views

detect an outlier in multi-dimensions - where the number of rows is not >> number of columns

I have the following situation: a data frame with two dimensions x and y, with three "areas": an a-parametric distribution ...
1
vote
0answers
130 views

Is pairwise distance matrix useful to k-means?

The k-means implemented in scikit-learn precomputes distances but I don't how these distances are used. In its standard version, k-means is known to compute only the distances between the points and ...
5
votes
1answer
491 views

Suitable distance metric for time-series clustering with respect to location of shapes

I'm doing clustering on time-series (each time-series has the information for one day = 24 hours). For the clustering purpose, it's important for me to consider the time period in which the shape of ...
2
votes
0answers
166 views

Obtain within-group Gram matrix out of distance matrix

Gram matrix Let $\bf X$ be a n x p dataset with columns (variables) centered. Then p x p $\bf X'X$ is the total scatter matrix ...
0
votes
0answers
32 views

How to compute distances with both categorical and continuous attributes?

I have to handle with a datast containing both categorical attributes (around 25) and continuous attributes (around 25). I would like to do outliers detection. I think that it would be a good idea to ...
0
votes
1answer
31 views

Single Linkage Clustering with Manhattan metric

Say suppose we are having 5 data points with 3 attributes each ... (4,3,1) (2,1,5) (1,2,3) (2,3,1) .... Now let us build the distance matrix. If we do Manhattan metric then the cell corresponding to ...
1
vote
0answers
100 views

What happens with Mahalanobis-Distance, when the assumption of equal Covariance-Matrices breaks down

Assume that we want to compare the forecast quality of various forecasters $f$ on $n$ values such as stock-market prices or whatever. We could then define a "Mahalanobis-Distance" (MD) (or rather ...
0
votes
0answers
35 views

Common methods to calculate total distance from data with categorical, continuous and counting variables

I have a data set with categorical, continuous and counting variables. I want to be able to use a method that will give me a distance for each pairwise data point. From my understanding, each type ...
0
votes
0answers
59 views

Similarity of two sets of points

PROBLEM I have one set of 10 points, $X = \{(x_1,y_1),\,\dots,\,(x_{10},y_{10})\}$ and two sets of 3 points each, $A = \{ (a_1,b_1),\, (a_2,b_2),\, (a_3,b_3) \}$ and $C = \{(c_1,d_1),\,(c_2,d_2),\,(...
0
votes
0answers
19 views

Which is the best distance metric in an Indicator matrix

Is it okay to use the $\chi^2-distance$ when we have a indicator matrix? With Indicator matrix I mean the complete dijuntive table that is used in the Multiple Correspondence analysis. I mea n, if we ...
0
votes
1answer
120 views

Is Earth Mover Distance has maximum bound?

I have two probability distributions which each distribution has sum up to 1. I want to compute the distance between those two probability distributions. I want to use Earth Mover Distance to ...