Finding K nearest neighbors

4 ビュー (過去 30 日間)
Aram
Aram 2012 年 7 月 20 日
Hi guys,
I am trying to find K nearest neighbors from a normalized matrix based on 'cosine' distance. I know that there is a command namely 'knnsearch' which calculate the distance and finding the k nearest neighbors at the same time in MATLAB 2012, but I have 2009a version. does anyone know if it is possible to use knnsearch in MATLAB 2009b?
Regards, Aram

採用された回答

Star Strider
Star Strider 2012 年 7 月 20 日
編集済み: Star Strider 2012 年 7 月 20 日
The ‘knnsearch’ function was introduced in 2010a. If you have ‘pdist’ (see http://www.mathworks.com/help//stats/pdist.html ) or ‘pdist2’ (see http://www.mathworks.com/help//stats/pdist2.html ), you can probably generate your own version of ‘knnsearch’. If you have to write your own cosine distance metric as well, you can find the expression on those pages. The ‘sort’ function (with two output arguments) may also be useful.

その他の回答 (0 件)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by