Re: Fw: Clustering::Distance.php
| From: | Jesus M. Castagnetto | Date: | Tue, 13 Aug 2002 07:07:52 +0000 |
| Subject: | Re: Fw: Clustering::Distance.php | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-8344@lists.php.net to get a copy of this message | ||
--- alfredo <yo@alfredorahn.com> wrote:
> 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!
If you know an existing C lib that does metrics/clustering/similarity, then you
can use SWIG to generate the PHP wrapper functions to use that. I can give a
hand w/ the little I know the process if needed.
> 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?".
Yep, if there is a C lib for that, then the wrapper methods can decide on the
fly whether to use the PHP or the C implementation of the algorithm.
> The factory method is nice, but I'm not quite sure to understand in which we
> can
> use it here.
I was thinking in OOP terms, where each metric can be an object, and there is a
factory method that generates the appropriate object depending on the
parameters. Something along the lines of the DB::connect() method in PEAR DB.
> > > 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.
+1 for that name
> And I think: Would it be necessary (or just cool?) that the Math_Distance
> package provides an interface
> for measuring between Math_Vector objects?
Could be but we should try and not create too many interdependencies among
classes. I was thinking on only 3 metrics for vectors: cartesian distance and
the other 2 mentioned below.
> 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?).
Cool, that is an interesting idea. Now we just need some fuzzy logic and bits
of that sort to have some neural nets and other crazy stuff.
> > 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).
That will be a nice bioinformatics tool, one that might be useful for genome
classification, etc. I remember seeing an interesting clustering paper and
program from IBM some time ago, I think the name of the program was 'cviz' or
something like that.
> 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.
That can be *very* useful, I can think of network node graphs and other related
stuff that people saner than I am can used ;-)
> In another order of ideas, and with the proper respect to the list: How can
> I obtain a CVS account on Pear?
Go to
http://pear.php.net/account-request.php
> Saludos
>
> Alfredo Rahn
=====
--- Jesus M. Castagnetto (jcastagnetto@yahoo.com)
Research:
http://metallo.scripps.edu/
Personal: http://www.castagnetto.org/
__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com