Thomas Dent

2013-01-21 19:53:48 UTC

Hi all,

I just started using sklearn nearest-neighbors for classification & would like to apply my own distance weighting function.

To do this I need to know exactly what the 'distance' that is fed to the function represents. (Current documentation doesn't give me an immediate answer.)

For example if I set p=2 do I get the Euclidean distance, i.e. the square root of the sums of squares of coordinate differences; or the square of it?

If p>2 do I get the distance, in the sense of the p-th root of sum of p-th powers, or the p-th power of distance?

Thanks,

Tom

--

-----------------------------------------

Institute for Gravitational Physics

(Albert Einstein Institute)

Callinstr. 38

D-30167 Hannover, Germany

I just started using sklearn nearest-neighbors for classification & would like to apply my own distance weighting function.

To do this I need to know exactly what the 'distance' that is fed to the function represents. (Current documentation doesn't give me an immediate answer.)

For example if I set p=2 do I get the Euclidean distance, i.e. the square root of the sums of squares of coordinate differences; or the square of it?

If p>2 do I get the distance, in the sense of the p-th root of sum of p-th powers, or the p-th power of distance?

Thanks,

Tom

--

-----------------------------------------

Institute for Gravitational Physics

(Albert Einstein Institute)

Callinstr. 38

D-30167 Hannover, Germany