"Fuzzy" Counter?

Chris Angelico rosuav at gmail.com
Tue Sep 23 12:41:04 EDT 2014


On Wed, Sep 24, 2014 at 2:32 AM, Rob Gaddi
<rgaddi at technologyhighland.invalid> wrote:
> You'll probably have to write that yourself.  While you're at it, think
> long and hard about that definition of fuzziness.  If you can make it
> closer to the concept of histogram "bins" you'll get much better
> performance.  If, for instance, you can live with 1.anything being one
> bin, and 2.anything being the next (even though this puts 1.999 and
> 2.000 into separate bins) then you can just floor() the number and use
> the result as the key.

Or even check three bins based on that - the floor(), floor()+1, and
floor()-1 bins. That way, you're not running into problems at any
boundaries, and you still limit the exponential growth of the
comparisons.

But it's still fundamentally problematic.

ChrisA



More information about the Python-list mailing list