Sign up ×
Computational Science Stack Exchange is a question and answer site for scientists using computers to solve scientific problems. It's 100% free, no registration required.

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?

share|improve this question
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 – 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

1 Answer 1

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

share|improve this answer
Is that paper also available separately, so that one doesn't have to download the library? – Arnold Neumaier Nov 21 '12 at 10:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.