AffinityPropagation .labels_ vs .predict()
--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Over Ancient Waters Looping
--
Chapters
00:00 Affinitypropagation .Labels_ Vs .Predict()
00:25 Accepted Answer Score 4
01:08 Thank you
--
Full question
https://stackoverflow.com/questions/5390...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #machinelearning #scikitlearn #clusteranalysis
#avk47
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Over Ancient Waters Looping
--
Chapters
00:00 Affinitypropagation .Labels_ Vs .Predict()
00:25 Accepted Answer Score 4
01:08 Thank you
--
Full question
https://stackoverflow.com/questions/5390...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #machinelearning #scikitlearn #clusteranalysis
#avk47
ACCEPTED ANSWER
Score 4
Don't use predict with any clustering except k-means-family.
If you do fit, the result is computed with affinity propagation.
If you invoke predict, it is not actually doing AP. Instead, it just finds the nearest exemplar for each point. That may, or may not, give the same results, as you have observed. Since near points are most likely responsible, this has a high chance of being correct - but it is not doing any form of affinity propagation, it is a nearest-neighbor classification to the exemplars.
k-means is fine because it uses the nearest-center logic. But that does not generally hold for clustering. In general, clustering algorithms cannot predict for out-of-sample data; you need a classififer for that.