5
$\begingroup$

I have a large table of attributes of different real-world movie theaters. I have classified them by the "true" physical entity to which they belong, so that there may be multiple records for a given movie theater entity.

In this table, I have information such as names, how many screens they have, etc. Given some identifying information (part of the name, one line of the address and number of screens, say) I would like to classify the given information to the entity with which it is associated, and add it to the database.

I was thinking of using an algorithm such as nearest neighbour but the choice of distance metric seems limiting. The only implementations I have seen use all numeric or all text information to calculate distance.

How would I calculate a distance metric for data that may be numeric, text and categorical in nature?

$\endgroup$
6
$\begingroup$

You are referring to a very hard problem of finding the best possible metric. It is a hard problem even for the unimodal data, the multimodal case you are referring to is a great challenge. There are basically three possibilities:

  • use some primitive metric, like Euclidean distance, treating everything as numbers (you can convert categorical values to some values as well). This will yield rather poor results, but is the simplest possibility and gives you time for analysis and optimization of the rest of the system.
  • perform deep analysis of your data and/or find an expert able to design a good metric. This is the most hard to do, but would yield the best results (assuming that you have access to "real expert").
  • add additional abstraction layer to your problem and treat finding this metric as an optimization problem on its own. There are numerous studies showing how one can find good multi-modal metrics for any kind of data by formalizing it as an optimization problem and applying one of many known mathematical solvers. Some examples of such studies would be:

$\endgroup$
4
$\begingroup$

First of all, you must realize that there isn't the single one "correct" distance for your data.

Given two coordinates, Euclidean distance is appropriate when looking at a short distance without restrictions on travel. Manhattan distance is usually more appropriate when you are in a city with a grid layout. However, for more accurate travel times, you will need to look at the underlying road network and the network distance therein. Oh, and if you are looking at intercontinental coordinates, the various different formulas for approximating great-circle distance may be a good choice.

So even for 2d coordinates on earth, there is no "correct" distance without side information and extra data.

Now for non-vectorspace mixed type data, there do exist a number of metrics that you may want to understand and try out; such as Gower's similarity measure.

$\endgroup$

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.