Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^5: grouping numbers

by mtmcc (Hermit)
on Jul 11, 2013 at 14:04 UTC ( #1043733=note: print w/replies, xml ) Need Help??


in reply to Re^4: grouping numbers
in thread grouping numbers

Compared to -5000 and +5000, they're all 'close' together.

I think you first need to think about how you would like to define 'close together' and 'far apart' in practical terms, and when you've worked that out, write some code.

I'm happy to be corrected if I'm missing something...

Good luck!

Replies are listed 'Best First'.
Re^6: grouping numbers
by ag4ve (Monk) on Jul 11, 2013 at 14:28 UTC

    That's why I had $avg - I don't really like taking the average distance to do this (I'd much prefer to have a score system where I get everything and then filter out after) but as I can't even figure this out, I figure this is a good starting point. I could work with it if I got this working at least.

      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
      --
      Quantum Mechanics: The dreams stuff is made of

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1043733]
help
Chatterbox?
[stevieb]: I'm checking some other versions. This is a little frightening
[pryrt]: Sorry, my bad: it was't done downloading when I did the sha1sum... now I match your 309ad... value
[stevieb]: I'll see how to get in touch with someone and advise that there's an issue. Thanks for helping me confiirm pryrt!
[pryrt]: 5.14.2.1-32 also mismatches; but 5.24.1.1-64 matches their sha1

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (12)
As of 2017-03-29 21:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (353 votes). Check out past polls.