we have the characteristics and (scalar) values of those characteristics for three (or more) people:

Person A: {height: 1, weight: 2, type: 1}

Person B: {height: 1, weight: 2, type: 5}

Person C: {weight: 2, type: 1}

I'm trying find a distance measure that helps decide if Person A and C are more similar to each other or if Person A and B are.

If we had categorical data, I would use the Jaccard distance, but now I am trying to include the scalar values in the calculation.

The key concept is that there are some pairings where the characteristic set is incomplete and I would like to know if there is any distance scoring algorithm that handles that elegantly.

PS I'm not really sure how to ask this question and quite new at this, so please feel free to ask me to edit / rephrase rather than closing the question if it's not up to community standards.

  • $\begingroup$ I would be careful using distance measures when the dimensions have vastly different distributions. Let's say height and weight are nearly Gaussian, and type is Poisson. $\endgroup$ – Aksakal Apr 27 '15 at 18:54
  • $\begingroup$ When you have different types of variables (continuous, ordinal, categorical), the default distance is Gower's distance, see this pdf. $\endgroup$ – gung - Reinstate Monica Apr 27 '15 at 19:22

I would use Mahalonobis distance. When the variable is missing, simply skip it when constructing the covariance matrix and the distance itself.

  • $\begingroup$ For people reading this in the future, here is a link to its implementation in Python. docs.scipy.org/doc/scipy-0.14.0/reference/generated/… $\endgroup$ – Phil B Apr 27 '15 at 18:51
  • $\begingroup$ Check that it handles missing data the way you expect. $\endgroup$ – Aksakal Apr 27 '15 at 18:52
  • $\begingroup$ I'll run some tests on it later, thanks a lot for the quick answer! $\endgroup$ – Phil B Apr 27 '15 at 18:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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