# $k$-Nearest Neighbor Search using examples

I want to perform $k$-Nearest Neighbor Search in multidimensional space, but not using for example $L_2$-distance. I want the user to specify some "similar"-pairs examples and then perform a search using this information.

What algorithm can I use for this?

-
Can you be a bit more specific regarding what type of metric you want to use? – Pedro Nov 20 '12 at 14:11
@Pedro I don't know what metric I want, but I think it must depend on data. I don't know what "similar" mean, but I have pairs(examples) which are similar and I want to extract similarity metric from this data and then perform K-Nearest Neighbor Search. Maybe I can use metric like here slide 10 cui.unige.ch/AI-group/teaching/dmc/09-10/cours/dm16-ml.pdf – mrgloom Nov 21 '12 at 14:05
@mrgloom So do you want to train a classifier and then apply that to determine neighbors? – Deathbreath Jan 7 '13 at 14:24

This functionality is implemented in the libAGF library. Check here: http://libagf.sourceforge.net/download.html To get an overview (the webpage is not very informative), download the library and check for the agf_paper in doc directory.