finding euclidean distance,better code?
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Fri Mar 28 19:18:46 EDT 2008
En Fri, 28 Mar 2008 18:15:04 -0300, harryos <oswald.harry at gmail.com>
escribió:
> if i were to calculate the euclidean distance in the above example how
> should i go about it..?
> should i replace
> distance = abs(input_wk - weights[image, :])
> with something else?
For a single 2D vector, math.hypot does what you want. But the above looks
like a NumPy array; see this thread
http://projects.scipy.org/pipermail/numpy-discussion/2007-April/027166.html
--
Gabriel Genellina
More information about the Python-list
mailing list