I have a database holding 10-ish features that describe different breeds of dogs. They are mostly categorical features, but some provide ranges for values. Here's a demo representation of the database, showing the mixture:

|Dober|20        |20        |40        |52        |sport  |FALSE      |
|Pood |15        |25        |35        |45        |water  |TRUE       |

As you can see, the data is mixed and the ranges have some overlap from entry to entry.

Say I receive an input of:

|16    |43    |water  |TRUE       |

I need to calculate the 5 most similar breeds in the database, and give the user a probability of it being each of those 5.

The pain point is the ranges provided, the way they overlap, and the mixed datatype nature of the problem. Gower's Distance caught my eye, but the ranges are throwing me off.

I thought about just calculating the mean for the ranges and calculating the similarity between input and the means, but in the case of the min_height and max_height in the example database above, the mean would be the same between entries! So that won't work.

Something that allows me to assign weights to features would be nice too (ex : we are confident in accuracy of the input weight value, not as much in height, so add some favor to weight when making our similarity calculation).

How should I approach this classification problem?


1 Answer 1


There are lots of possibilities.

One would be to obtain for each feature a "score" and then create as a total rank a weighted sum of those scores $s_i$, with weights $w_i$ chosen by a domain expert like you. Thus, if $x$ is the considered dog: $$ rank(x) = \sum_{i=1}^n w_i s_i(x). $$

The score $s_i(x)$ for each feature $i$ could be chosen as follows: for features with a range, the score could be, as you have suggested, the distance to the middle of the range divided by the size of the range (Gower). The scores for the boolean features could be just 0 and 1 depending on whether it is true or not.

It is then not a problem if the ranges overlap or the means of some features coincide.


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.