Re: Fw: Clustering::Distance.php
| From: | alfredo | Date: | Tue, 13 Aug 2002 06:48:45 +0000 |
| Subject: | Re: Fw: Clustering::Distance.php | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-8342@lists.php.net to get a copy of this message | ||
From: "Jesus M. Castagnetto" <jcastagnetto@yahoo.com>
> Nice class Alfredo.
Thanks Jesus!
> > please feel free to make any comments that you think might help to
PEARIZE
> > this code w/o harming efficience.
>
> The code looks OK to me (on a very quick glance). The advantage of having
on
> monolitical Distance class is that you can calculate different metrics on
the
> same data set. The disadvantage could be in the addition of more
> metrics/similarity indeces. At the moment I would go for your solution, if
and
> when things get too complicated, then the class can be changed to use a
factory
> method.
Well, I have a wish of (someday?) coding the distance functions in c, quite
sure
that as Zend's got them they'll behave quite speedy!
As you saw on the class, there's an array with metric names and function
names,
so the idea behind this is that the class may allow to add new metrics, just
by
refering their function names in this structure.
These functions could be members of the class, system functions or part of a
library
written in php, and the class will surely provide a means for handling
measures in a whole data set,
and can be asked about "what metrics do you got?".
The factory method is nice, but I'm not quite sure to understand in which we
can
use it here.
> > please review it, and make any comments you like!!
>
> I can suggest some names for the class, because those metrics are
generalized
> distances, which can be used for clustering or other purposes:
>
> Math_DistanceMetric
>
> or
>
> Math_Cluster_Distance
>
> or
>
> Math_Distance
>
> Then the Math_Cluster class(es) can use the Math_Cluster)_Distance (or
> Math_DistanceMetric) object(s)
I totally agee with you. At this time I was thinking the same thing, because
there are many applications
for distance metrics. I think that Math_Distance would do it fine, as short.
And I think: Would it be necessary (or just cool?) that the Math_Distance
package provides an interface
for measuring between Math_Vector objects?
Consider also that the kind of objects we're going to compare are not
necesarilly vectors in R^d, but can be
also binary vectors and binary objects, such as strings (what about natural
language processing in php?).
> BTW, there are several metrics I did not know, but found this on Google:
>
> http://geochange.er.usgs.gov/pub/tools/analog/doc/distance.html
>
> http://fconyx.ncifcrf.gov/~lukeb/clusdis.html
Well, there's a lot of this stuff!
http://astro.u-strasbg.fr/~fmurtagh/mda-sw/online-sw.html
>
> There are other simple metrics for vectors, which might not need to be
there,
> but that I might add as a utility class for Math_Vector: City block
distance
> (aka Manhattan distance) and Chessboard Distance.
>
> City dist = |x1 - x2| + |y1 - y2| + ...
>
> Chessboard dist. = max(|x1 - x2|, |y1 - y2|, ...)
Well, I'll take a look as Math_Vector because Manhattan is a nice norm to
implement here.
One of the applications I've thought for this proyect is to deploy a SOAP
clustering/measurement
service, so as much options it has, the more helpful it would be for the
intended audiences (mathematicians,
biologists, chemistrians, etc).
Also, there's a whole bunch of different metrics, many of which don't
operate on R^d objetcs, but between
binary objects and binary vectors; and also methods for measuring graph
distances would be useful.
In another order of ideas, and with the proper respect to the list: How can
I obtain a CVS account on Pear?
Saludos
Alfredo Rahn