"Fuzzy" Counter?
Ethan Furman
ethan at stoneleaf.us
Fri Sep 26 12:20:12 EDT 2014
On 09/23/2014 09:32 AM, Rob Gaddi wrote:
> On Tue, 23 Sep 2014 05:34:19 -0700 (PDT) Miki Tebeka wrote:
>>
>> Before I start writing my own. Is there something like collections.Counter (fore frequencies) that does "fuzzy" matching?
>>
>> Meaning x is considered equal to y if abs(x - y) < epsilon. (x, y and my case will be numpy.array).
>
> 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.
You might want to take a look at the reference implementation for PEP 455 [1]. If you can decide on a method to
transform your keys (such as taking the floor, or the half, or something like that), then that should work as is.
--
~Ethan~
[1] http://legacy.python.org/dev/peps/pep-0455/
More information about the Python-list
mailing list