I have a 10 dimensional space which contain points that contain a 1 or 0 .

example of two points :

point1 : 1,1,1,0,0,0,1,1,0,1 
point2 : 1,0,1,0,0,0,1,0,0,0

Which distance function should I use for this. I've been trying Euclidean and Manhattan but I don't which one has an advantage over the other ?

This is binary data (1=present, 0=absent) to indicate what links are associated with a user.

For example the first binary digit might indicate that a user has www.google.com configured or not.

The clusters of links will each contain users links. For each cluster I want to recommend any link which one user has added but the other has not, this is just for users within the same cluster. So I guess this is a recommendation system based on k-means clustering.

  • $\begingroup$ It is important to know, where your data comes from (biology, ...). There are special indexes proposed for particular data. $\endgroup$
    – sitems
    Jul 19, 2013 at 16:10
  • 2
    $\begingroup$ The important question whether these data are binary (1=present, 0=absent) or dichotomous nominal (1=this, 0=that). $\endgroup$
    – ttnphns
    Jul 19, 2013 at 17:18
  • 6
    $\begingroup$ More important than either is to know why you are looking at these data in the first place. Without a context and a statement of objectives, we are left with an ill-posed, open-ended math problem and it is impossible to know how to give good statistical advice. So please edit this question to reply to these requests for clarification. $\endgroup$
    – whuber
    Jul 19, 2013 at 17:23
  • 1
    $\begingroup$ Thanks for editing. You responded well to the first two comments, but not to mine: please tell us what your investigation objectives are. What are you trying to find out? $\endgroup$
    – whuber
    Jul 19, 2013 at 17:59

2 Answers 2


For presence / absence data there are various more appropriate metrics than Manhattan and Euclidean, which are really designed for continuous variables.

You really need to read up on Tanimoto, Jaccard, Gower, Cosine, Sørensen-Dice, Hamming, Kulczyński, Czekanowski, Horn, Renkonen, ... just to name a few.

There is a pretty good book to see the variety of similarity functions that exist:

Dictionary of Distances

Elena Deza and Michel-Marie Deza

ISBN: 978-0-444-52087-6


It sounds like what you're trying to achieve in this problem is unsupervised feature based clustering, where each of your 10 "dimensions" (AKA features) are observed in a sample of individuals. This is often used to form recommender systems, such as in the Netflix data where each feature was a movie rating and each row was a viewer. The goal of such models is to predict one or more features in a randomly observed individual for which some subset of features are observed.

You'd be surprised how often Euclidean based distance functions are used to create predictions from such data, as is the case with SVD and PCA. Conversely, a dearth of less obvious clustering algorithms have proven to be useful despite not giving any explicit distance measures. In both cases, models are usually validated using measures of classification accuracy (PPV, Sens/Spec eg) in split sample validation. So if you use distance to measure prediction uncertainty, it will not tell you much.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.