cegme / vose

A discrete distribution sampler with really nice guarantees and performance properties.
2 stars 0 forks source link

Deduplication of marbles #2

Open cegme opened 11 years ago

cegme commented 11 years ago

Add a function that dedupes the repeated marble labels. This is like a reduce function that sums the duplicate weights. You can't really merge marbles, but lets pretend that they are play-doh balls. This can be done in some dedup() method.

cegme commented 11 years ago

We could keep track of all duplicates by keeping a min-count sketch and also counter. When each marble is inserted, add it to the min-count sketch. Check to see how many of the items are now present, if that number is greater than one increment the counter. When that counter is past some threshold, it is time to dedupe the structure. This threshold should take into account the time wasted searching duplicates and also the time it takes to dedupe.