Perl: the Markov chain saw | |
PerlMonks |
Re^7: grouping numbersby QM (Parson) |
on Jul 11, 2013 at 14:41 UTC ( [id://1043740]=note: print w/replies, xml ) | Need Help?? |
What you're trying to do is cluster analysis - naturally grouping data together in clusters (for some value of "naturally").
Most approaches I'm aware of require you to know the number of clusters ahead of time (which sort of defeats the purpose). However, if you can come up with some heuristic, such as "any element of a cluster must be within 10% of the center point of the cluster's range", you might be able to quickly compute the results, and live with them. (Of course there are pathological cases where adding a new element changes the center point, causing other elements to be cast out.) -QM
In Section
Seekers of Perl Wisdom
|
|