I am working on similarity calculation between entities of similar type. For each entity I am able to make a vector that comprises of multiple vectors itself.

  • A = 50*1 vector
  • B = 100*1 vector
  • C = 50*1 vector
  • D = [age, gender, x-feature, y-feature, z-feature]

Entity = [A B C D], basically concatenating all of those.

My problem is that: since they come from different spaces, each would have different orders of magnitude.
If I run KNN on these vectors, I doubt that results are going to be governed by features of one space only. What should be done to get best KNN results? What "normalisation" would be best here?


Since you have mixed data, use one-hot encoding for the categorical data so that they become binary data. For the numerical data, normalize them so that their ranges are within [0,1].

Next, you'll have to choose an appropriate distance measure. See the answer here: https://stats.stackexchange.com/questions/218092/how-to-calculate-the-distance-in-knn-for-mixed-data-types

| improve this answer | |

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.