Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: Optimizing a naive clustering algorithm

by RichardK (Parson)
on Apr 15, 2014 at 17:38 UTC ( #1082370=note: print w/replies, xml ) Need Help??

in reply to Optimizing a naive clustering algorithm

I haven't read about the concept (yet!) so I'm just commenting on your code.

Copying and manipulating those hashes in max_diff is going to be slow, lots of memory copies, and if I've understood correctly you don't need to do it that way. Wouldn't something like this give you the number you need?

sub max_diff { ... my $count = 0; for (keys %{$hash1}) { $count++ unless exists $hash2->{$_}; } for (keys %{$hash2}) { $count++ unless exists $hash1->{$_}; } return $count;

Replies are listed 'Best First'.
Re^2: Optimizing a naive clustering algorithm
by BUU (Prior) on Apr 15, 2014 at 18:23 UTC
    Ha, yes, I think you're right. I don't think it solves the overall problem but its a good catch.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1082370]
[Discipulus]: yes i saw your cell brother..
[Discipulus]: but now fuel is cheap and they still make some war.
[Discipulus]: capitalism is able to go to war by cycle, even.
[shmem]: some? are you jokin' ?
[shmem]: fuel is only one fuel that fuels the fools... it is all about power and control - which NOBODY will have.
[shmem]: ...can't have, since silly

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (10)
As of 2017-04-29 22:02 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (534 votes). Check out past polls.