Linked Questions

3 votes
1 answer
1k views

Can I use k-means with a distance matrix composed of percentages? [duplicate]

I have objects o1, o2,...,on and for each pair I calculate a value that measures the pair's difference. This is a percentage, so for example o1o2 differ by 56%. Now I want to cluster this data. I can ...
schoon's user avatar
  • 143
97 votes
6 answers
172k views

Why does k-means clustering algorithm use only Euclidean distance metric?

Is there a specific purpose in terms of efficiency or functionality why the k-means algorithm does not use for example cosine (dis)similarity as a distance metric, but can only use the Euclidean norm? ...
curious's user avatar
  • 1,111
112 votes
5 answers
237k views

Loadings vs eigenvectors in PCA: when to use one or another?

In principal component analysis (PCA), we get eigenvectors (unit vectors) and eigenvalues. Now, let us define loadings as $$\text{Loadings} = \text{Eigenvectors} \cdot \sqrt{\text{Eigenvalues}}.$$ I ...
user2696565's user avatar
  • 1,429
62 votes
4 answers
73k views

Why does correlation matrix need to be positive semi-definite and what does it mean to be or not to be positive semi-definite?

I have been researching the meaning of positive semi-definite property of correlation or covariance matrices. I am looking for any information on Definition of positive semi-definiteness; Its ...
Melon's user avatar
  • 629
31 votes
8 answers
36k views

Perform K-means (or its close kin) clustering with only a distance matrix, not points-by-features data

I want to perform K-means clustering on objects I have, but the objects aren't described as points in space, i.e. by objects x features dataset. However, I am able ...
mouse's user avatar
  • 313
22 votes
9 answers
12k views

Pairwise Mahalanobis distances

I need to calculate the sample Mahalanobis distance in R between every pair of observations in a $n \times p$ matrix of covariates. I need a solution that is efficient, i.e. only $n(n-1)/2$ distances ...
ahfoss's user avatar
  • 1,409
23 votes
4 answers
56k views

Euclidean distance score and similarity

I'm just working with the book Collective Intelligence (by Toby Segaran) and came across the Euclidean distance score. In the book the author shows how to calculate the similarity between two ...
navige's user avatar
  • 345
39 votes
2 answers
21k views

Understanding distance correlation computations

As far as I understood, distance correlation is a robust and universal way to check if there is a relation between two numeric variables. For example, if we have a set of pairs of numbers: ...
Roman's user avatar
  • 724
30 votes
1 answer
25k views

Converting similarity matrix to (euclidean) distance matrix

In Random forest algorithm, Breiman (author) constructs similarity matrix as follows: Send all learning examples down each tree in the forest If two examples land in the same leaf increment ...
Uros K's user avatar
  • 487
19 votes
4 answers
9k views

Is it ok to use Manhattan distance with Ward's inter-cluster linkage in hierarchical clustering?

I am using hierarchical clustering to analyze time series data. My code is implemented using the Mathematica function DirectAgglomerate[...], which generates ...
Rachel's user avatar
  • 191
10 votes
2 answers
27k views

K-means: Why minimizing WCSS is maximizing Distance between clusters?

From a conceptual and algorithmic standpoint, I understand how K-means works. However, from a mathematical standpoint, I don't understand why minimizing the WCSS (within-cluster sums of squares) will ...
slaw's user avatar
  • 504
7 votes
2 answers
19k views

Gower's (dis)similarity index

I would like to ask a question about Gower similarity/dissimilarity index. Is it ok to use the Gower dissimilarity measure with Ward linkage clustering? I was reading that the Gower similarity index ...
M. Tremmel's user avatar
9 votes
2 answers
2k views

Does a distance have to be a "metric" for an hierarchical clustering to be valid on it?

Let us say that we define a distance, which is not a metric, between N items. Based on this distance we then use an Agglomerative hierarchical clustering. Can we use each of the known algorithm (...
Tal Galili's user avatar
  • 21.9k
7 votes
4 answers
12k views

Pairwise Mahalanobis distance in R [duplicate]

I'm trying to calculate a Mahalanobis-type pairwise distance matrix in R. I have 33 individuals, each with 10 variables. The idea is to get a distance matrix D, where $$D_{i,j}=(\mathbf{X}_i-\mathbf{...
Javier's user avatar
  • 183
6 votes
2 answers
7k views

Sums-of-Squares (total, between, within): how to compute them from a Distance Matrix?

I am having trouble understanding the concept of Sum of Squares in the context of distance matrices (Studer et al. 2010). The Sum of Squares I am familiar with is the classical $SS$ from ANOVA, ...
giac's user avatar
  • 911

15 30 50 per page