[OT] Modesty and apologies [Re: Re; finding euclidean distance,better code?]

2008-03-29 Thread Steven D'Aprano
On Sat, 29 Mar 2008 12:43:22 +0200, Hendrik van Rooyen wrote: > Sorry about having to dispel your illusions, but - [...] > Have you noticed that when people say "Sorry.but" they are not > normally sorry at all? Heh heh heh. Reminds me of a quote from the character Spike of "Buffy the Vam

Re: finding euclidean distance,better code?

2008-03-29 Thread Steven D'Aprano
On Sat, 29 Mar 2008 13:06:27 +0100, Roel Schroeven wrote: > In any case, I replied because your reaction didn't feel all that gentle > to me; to be honest, it felt rather rude. Are you new to Usenet? :-) No offense taken; I hope Robert didn't take offense either, but took the little dig in the

Re: finding euclidean distance,better code?

2008-03-29 Thread Peter Otten
Steven D'Aprano wrote: > Wikipedia doesn't believe that M-D is the primary or most common name, > and the link you give redirects to "Taxicab distance". Googlefight > agrees: "Taxicab distance" is more than twice as common, and "rectilinear > distance" more than five times as common. Could it be

Re: finding euclidean distance,better code?

2008-03-29 Thread Gerard Flanagan
On Mar 29, 11:01 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Sat, 29 Mar 2008 10:11:28 +0100, Roel Schroeven wrote: > > Steven D'Aprano schreef: > >> On Fri, 28 Mar 2008 16:59:59 +0100, Robert Bossy wrote: > > >>> Gabriel Genellina wrote: > That's what I said in anot

Re: Re; finding euclidean distance,better code?

2008-03-29 Thread Maurice LING
Hendrik van Rooyen wrote: > On Saturday 29 March 2008 03:09:46 Steven D'Aprano wrote: >> On Fri, 28 Mar 2008 16:59:59 +0100, Robert Bossy wrote: >>> Gabriel Genellina wrote: That's what I said in another paragraph. "sum of coordinates" is using a different distance definition; it's the wa

Re: finding euclidean distance,better code?

2008-03-29 Thread Roel Schroeven
Steven D'Aprano schreef: > On Sat, 29 Mar 2008 10:11:28 +0100, Roel Schroeven wrote: > >> Steven D'Aprano schreef: >>> On Fri, 28 Mar 2008 16:59:59 +0100, Robert Bossy wrote: >>> Gabriel Genellina wrote: > That's what I said in another paragraph. "sum of coordinates" is > using a diff

Re; finding euclidean distance,better code?

2008-03-29 Thread Hendrik van Rooyen
On Saturday 29 March 2008 03:09:46 Steven D'Aprano wrote: > On Fri, 28 Mar 2008 16:59:59 +0100, Robert Bossy wrote: > > Gabriel Genellina wrote: > >> That's what I said in another paragraph. "sum of coordinates" is using > >> a different distance definition; it's the way you measure distance in a >

Re: finding euclidean distance,better code?

2008-03-29 Thread Steven D'Aprano
On Sat, 29 Mar 2008 10:11:28 +0100, Roel Schroeven wrote: > Steven D'Aprano schreef: >> On Fri, 28 Mar 2008 16:59:59 +0100, Robert Bossy wrote: >> >>> Gabriel Genellina wrote: That's what I said in another paragraph. "sum of coordinates" is using a different distance definition; it's th

Re: finding euclidean distance,better code?

2008-03-29 Thread Roel Schroeven
Steven D'Aprano schreef: > On Fri, 28 Mar 2008 16:59:59 +0100, Robert Bossy wrote: > >> Gabriel Genellina wrote: >>> That's what I said in another paragraph. "sum of coordinates" is using >>> a different distance definition; it's the way you measure distance in a >>> city with square blocks. I don

Re: finding euclidean distance,better code?

2008-03-28 Thread Steven D'Aprano
On Fri, 28 Mar 2008 16:59:59 +0100, Robert Bossy wrote: > Gabriel Genellina wrote: >> That's what I said in another paragraph. "sum of coordinates" is using >> a different distance definition; it's the way you measure distance in a >> city with square blocks. I don't know if the distance itself ha

Re: finding euclidean distance,better code?

2008-03-28 Thread Gabriel Genellina
En Fri, 28 Mar 2008 18:15:04 -0300, harryos <[EMAIL PROTECTED]> 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.hypo

Re: finding euclidean distance,better code?

2008-03-28 Thread harryos
> the norm from which it is derived is called norm-1, or L1; the usual > > euclidean distance is derived from norm-2. > If you only want to see if two things are "close enough", this provides a > faster measure than the euclidean distance. thanks Gabriel for the detailed explanation.. if i w

Re: finding euclidean distance,better code?

2008-03-28 Thread castironpi
On Mar 28, 10:15 am, harryos <[EMAIL PROTECTED]> wrote: > > The code is pretty legible as it is now. Anyway, using min() and a > > generator: > > hi > is this calculated distance really Euclidean distance? When i checked > wikipediahttp://en.wikipedia.org/wiki/Euclidean_distance > it shows a calcul

Re: finding euclidean distance,better code?

2008-03-28 Thread Robert Bossy
Gabriel Genellina wrote: > That's what I said in another paragraph. "sum of coordinates" is using a > different distance definition; it's the way you measure distance in a city > with square blocks. I don't know if the distance itself has a name, but I think it is called Manhattan distance in

Re: finding euclidean distance,better code?

2008-03-28 Thread Gabriel Genellina
En Fri, 28 Mar 2008 12:15:48 -0300, harryos <[EMAIL PROTECTED]> escribió: >> The code is pretty legible as it is now. Anyway, using min() and a >> generator: >> >> > > hi > is this calculated distance really Euclidean distance? When i checked > wikipedia http://en.wikipedia.org/wiki/Euclidean_di

Re: finding euclidean distance,better code?

2008-03-28 Thread harryos
> The code is pretty legible as it is now. Anyway, using min() and a > generator: > > hi is this calculated distance really Euclidean distance? When i checked wikipedia http://en.wikipedia.org/wiki/Euclidean_distance it shows a calculation involving sum of squares of the differences of elements.He

Re: finding euclidean distance,better code?

2008-03-17 Thread [EMAIL PROTECTED]
On Mar 17, 6:17 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote > > _, imgindex = min((sum(abs(input_wk - weights[image, :])),image) for image > in xrange(numimgs)) > mindistance = abs(input_wk - weights[imgindex, :]) > # normalize and sum again thanks Gabriel D -- http://mail.python.org/mailm

Re: finding euclidean distance,better code?

2008-03-17 Thread Gabriel Genellina
En Mon, 17 Mar 2008 03:04:16 -0200, [EMAIL PROTECTED] <[EMAIL PROTECTED]> escribi�: > while trying to write a function that processes some numpy arrays and > calculate euclidean distance ,i ended up with this code > (though i used numpy ,i believe my problem has more to do with python > coding s

finding euclidean distance,better code?

2008-03-16 Thread [EMAIL PROTECTED]
hello while trying to write a function that processes some numpy arrays and calculate euclidean distance ,i ended up with this code (though i used numpy ,i believe my problem has more to do with python coding style..so am posting it here) ... # i am using these numpy.ndarrays to do the calculation