in reply to RFC: Fuzzy Clustering with Perl

I just added a description for the distance function. The next step will be to modify the script in such a way that the user can select between different distance functions. This might seem trivial at first but it is not. As I mentioned in the description of the distance function, different distance functions will result in different ways of computing the prototypes. If you have any suggestion on how I could generalize the computation of the prototypes based on the selected distance function, please, drop me a line

Thank you,

lin0

Replies are listed 'Best First'.
Re^2: RFC: Fuzzy Clustering with Perl
by dk (Chaplain) on Nov 06, 2006 at 15:11 UTC
    You might want to encapsulate the code under a sub, where one of parameters will be the distance function name. Other parameters could also be named parameter, as well. This is a very widely spread perl technique. For example, this sub would be called then as
    my $result = cluster( num_clusters => 5, data => [1,2,3,4,5], distance => 'procrustes' );
    This way, if the programmer does not specify all parameters, there will be subsituted sensible defaults ( possibly different for each distance ). Also the sub can die if there's not enough or invalid parameters given.

      Hi dk

      Thanks for the pointer. Now, I am working on a new version of the script. I will have it ready this weekend. I hope you could have a look at it and make some comments

      Cheers!

      lin0