What data is needed to implement k nearest neighbor?

I currently have a site like reddit-clone. I am trying to recommend posts based on posts that my users previously liked.

It seems that K is the closest neighbor or k means the best way to do this.

I can’t figure out how to implement this. I saw some mathematical formulas (for example, one on page k means a wikipedia page), but for me it does not make sense.

Can someone recommend some pseudo-code or places for viewing so that I can better understand how to do this?

+5
source share
5 answers

K-Nearest Neighbor ( KNN) - .

, N . , , , . , , ..

"" , "" . "" . , 3- .

" ", , . N- , N , .

:

, / , . , , , / , , .

, , ? , ?

/ X, Y. , , , ? , , 10 . 10 . 10 , , . 6 , 4 , , ? , .

KNN - , , "" .

+8

, , , , k-, . , reddit , , " + reddit", . Reddit, Stumbleupon, Del.icio.us Hacker News Exposed! k-NN ( , ) , , ( Amazon, ), .

+2

k - - . ,

1,2,3,4,6,7,8,9,10,11,12,21,22,33,40

, k- , k- (/), , . .

cluster-1 
1,2,3,4,5,6,7,8

cluster-2
10,11,12

cluster-3
21,22

cluster-4
33

cluster-5
40

, ( 1-5). , , , ( k-). .

kmeans , ( , ), . , , , , kmean.

, .

+1

k- , k , (, , ), http://www.cs.umd.edu/~mount/ANN/. - p, k p k .

, - , , , , , .

, http://www.cs.waikato.ac.nz/ml/weka/ - , .

+1

All Articles