Given two vectors containing numbers that have different natures / units, (example length in Meters and weight in Kilograms), does it make sense to calculate euclidean distance between these two vectors or cosine similarity?

The equations imply that you have to add $meters^2$ and $kilometers^2$ which supposedly does not make sense. Yet, I see this done many times indirectly, for instance, when calculating cosine similarity of documents based on tf-idf (vector that contains objects with dissimilar natures).


Speaking as an ex-physicist, I would say it never makes sense to add quantities with different units. When problems like this do arise it makes sense to honestly define some scale constants, normalize your quantities with respect to those constants and then add them.

This 'define and normalize' will likely not change much of your procedure, but being explicit about your constants can help to avoid problems later on.

If you want to consider meters and kilogarms to be part of the same metric space, it means that somewhere in your problem there must be a constant with units kilogram/meter, i.e. linear density. Such constants frequently arise in natural sciences, and can be quite interesting in their own right. Charge of electron, speed of light, are just few. I would suggest trying to understand how this linear density constant arises in your problem, might be an interesting insight.

It will become even more interesting if you have two constants with the same units in your problem. Then their relative values can indicate qualitative switch in behaviours. For example, https://en.wikipedia.org/wiki/Reynolds_number are unit-less numbers that indicate whether or not you can have turbulence.

I understand this is not a physics question :-)


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.