Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #78223
| From | Rob Gaddi <rgaddi@technologyhighland.invalid> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: "Fuzzy" Counter? |
| Date | 2014-09-23 09:32 -0700 |
| Organization | Highland Technology, Inc. |
| Message-ID | <20140923093244.066bb10b@rg.highlandtechnology.com> (permalink) |
| References | <0d28ee82-2240-4f10-9db9-e966c0e62a13@googlegroups.com> |
On Tue, 23 Sep 2014 05:34:19 -0700 (PDT) Miki Tebeka <miki.tebeka@gmail.com> wrote: > Greetings, > > 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). > > Thanks, > -- > Miki 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. If you really need the continuous fuzziness you'll probably have to keep the potential keys sorted and run a binary search against the list of them to find the nearest. This will still run you into some problems based on ordering. For instance, with an epsilon of 0.1, you'd put 2.0 into a bin, then 1.9 into the same bin, then 2.1 into the same bin. If however you put 1.9 into that bin first, then 2.0 would go into that bin, but 2.1 would go into a different one. TL;DR you need to think very hard about your problem definition and what you want to happen before you actually try to implement this. -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address domain is currently out of order. See above to fix.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
"Fuzzy" Counter? Miki Tebeka <miki.tebeka@gmail.com> - 2014-09-23 05:34 -0700
Re: "Fuzzy" Counter? Peter Otten <__peter__@web.de> - 2014-09-23 15:36 +0200
Re: "Fuzzy" Counter? Miki Tebeka <miki.tebeka@gmail.com> - 2014-09-23 21:57 -0700
Re: "Fuzzy" Counter? random832@fastmail.us - 2014-09-26 13:57 -0400
Re: "Fuzzy" Counter? Tim Chase <python.list@tim.thechases.com> - 2014-09-23 08:42 -0500
Re: "Fuzzy" Counter? Rob Gaddi <rgaddi@technologyhighland.invalid> - 2014-09-23 09:32 -0700
Re: "Fuzzy" Counter? Chris Angelico <rosuav@gmail.com> - 2014-09-24 02:41 +1000
Re: "Fuzzy" Counter? Miki Tebeka <miki.tebeka@gmail.com> - 2014-09-23 22:01 -0700
Re: "Fuzzy" Counter? Ian Kelly <ian.g.kelly@gmail.com> - 2014-09-24 08:56 -0600
Re: "Fuzzy" Counter? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-09-26 16:45 +1000
Re: "Fuzzy" Counter? Miki Tebeka <miki.tebeka@gmail.com> - 2014-09-26 01:23 -0700
Re: "Fuzzy" Counter? Rob Gaddi <rgaddi@technologyhighland.invalid> - 2014-09-26 11:30 -0700
Re: "Fuzzy" Counter? random832@fastmail.us - 2014-09-26 15:10 -0400
Re: "Fuzzy" Counter? Rob Gaddi <rgaddi@technologyhighland.invalid> - 2014-09-26 12:36 -0700
Re: "Fuzzy" Counter? Ethan Furman <ethan@stoneleaf.us> - 2014-09-26 09:20 -0700
csiph-web