how to find K nearest neighbors?

4 Ansichten (letzte 30 Tage)
Aram
Aram am 26 Apr. 2013
Hi guys,
I have a sparse matrix and I need to find the 10 nearest neighbors between each row and the rest rows of the matrix. I used this command: [idx, D] =knnsearch(B,A,'distance','cosine','K',10); but the problem is that no matter which value I choose for K, it finds only one nearest neighbor! can anyone have any idea?
Thank you, Aram
  1 Kommentar
Cedric
Cedric am 26 Apr. 2013
Bearbeitet: Cedric am 26 Apr. 2013
What does "between each row and the rest of the matrix" mean? You have e.g. row 400 and you want to get the 10 elements whose row indices are closest to 400 whatever their columns are? If so, does it include elements on row 400? Or is it about values? E.g. 10 closes values to row 400 average/median?

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by