Satra, I don't think scikit-learn currently has the functionality you mention, but it's something that should be a goal. A while ago I opened an issue addressing part of this: https://github.com/scikit-learn/scikit-learn/issues/351 Though inclusion of more general distance metrics in the tree codes would be difficult, it would be fairly straightforward to extend the brute-force Neighbors Classifier to use the distance metrics available in sklearn.pairwise, as well as perhaps an arbitrary user-defined distance. This is one of my goals for the coding sprint in December.
For the future, it might be interesting to think about how more general distance metrics could be included in the BallTree. It's possible in theory, because the Ball Tree algorithm works for any metric satisfying the triangle inequality. We could write a libary of c/cython distance metric functions and use function pointers within the BallTree evaluation to allow the user to specify which metric they'd like to use. Jake Satrajit Ghosh wrote: > hi all, > > does anybody or some blackhole in sklearn have an implementation of a > kneighbors classifier with a custom distance function? > > cheers, > > satra > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > RSA® Conference 2012 > Save $700 by Nov 18 > Register now > http://p.sf.net/sfu/rsa-sfdev2dev1 > ------------------------------------------------------------------------ > > _______________________________________________ > Scikit-learn-general mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/scikit-learn-general > ------------------------------------------------------------------------------ RSA® Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 _______________________________________________ Scikit-learn-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
