0
$\begingroup$

I have a data set where the samples are people and the feature are their age, sex, location, job, height, weight… Then I will have a new person with the same information and my goal is the find the twenty closest persons from him/her.

I think a clustering algorithm on Python could do the job. But there is a lot of different clustering algorithms and I don’t know which one will fit my problem the best.

KMeans seems to be the easiest clustering method but I don’t know the number of clusters. Same problem with Ward hierarchical clustering.

Mean shift seems more advanced and complicated, I haven’t found a lot of documentation on it. Then my data set is about $100 000$ samples and the maximum recommended is $10 000$ for MeanShift but I could easily separate the data set per area to reduce its size.

Do you think a clustering method is a good idea ? Which one should be the best for my problem ?

$\endgroup$
2

1 Answer 1

2
$\begingroup$

If you're looking for the 20 most similar persons I would recommend a simple k-NN classifier with k = 1. That means all instances of a person are represented by only one (perhaps big) feature vector. After all distances are calculated regarding all feature vectors (= persons) you just sort them in an ascending order and pick the 20 nearest neighbours. That's it...

$\endgroup$
4
  • $\begingroup$ That's a good idea. Do you recommend a particular library to do this ? $\endgroup$
    – mitsi
    Jul 9, 2016 at 10:05
  • $\begingroup$ You don't need a library for a simple k-NN classifier. You can implement it in less than 8 lines of code. The core of a k-NN is distance function. I recommend to use something simple like a Manhatten distance function: $/sum_{i=0}^n |x_{i} - y_{i}|$ $\endgroup$ Jul 9, 2016 at 10:39
  • $\begingroup$ This is a good idea but I don't think it's quite as simple here, because the data includes continuous and categorical data. I think that some effort will need to be put into defining the distance function. $\endgroup$
    – Peter Flom
    Jul 9, 2016 at 13:53
  • $\begingroup$ I see....well try out one of the surveys here: bfy.tw/6fKN $\endgroup$ Jul 9, 2016 at 14:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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