Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #78211

Re: "Fuzzy" Counter?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python.list@tim.thechases.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.014
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'subset': 0.09; 'cc:addr :python-list': 0.11; '(x,': 0.16; '-tkc': 0.16; '[*]': 0.16; 'counter()': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'inputs': 0.16; 'limiting': 0.16; 'wrote:': 0.18; 'differ': 0.19; 'cc:addr:python.org': 0.22; 'own.': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'sort': 0.25; 'compare': 0.26; 'header:In- Reply-To:1': 0.27; 'possibility': 0.29; 'gives': 0.31; 'container': 0.31; 'keys': 0.31; 'could': 0.34; 'something': 0.35; 'equal': 0.35; 'there': 0.35; 'charset:us-ascii': 0.36; 'possible': 0.36; 'subject:?': 0.36; 'should': 0.36; 'two': 0.37; 'received:10': 0.37; 'performance': 0.37; 'does': 0.39; 'subject:" ': 0.39; 'skip:n 10': 0.64; 'to:addr:gmail.com': 0.65; 'within': 0.65; 'expectations': 0.74
X-Sender-Id wwwh|x-authuser|tim@thechases.com
X-Sender-Id wwwh|x-authuser|tim@thechases.com
X-MC-Relay Neutral
X-MailChannels-SenderId wwwh|x-authuser|tim@thechases.com
X-MailChannels-Auth-Id wwwh
X-MC-Loop-Signature 1411479887518:609831691
X-MC-Ingress-Time 1411479887518
Date Tue, 23 Sep 2014 08:42:46 -0500
From Tim Chase <python.list@tim.thechases.com>
To Miki Tebeka <miki.tebeka@gmail.com>
Subject Re: "Fuzzy" Counter?
In-Reply-To <0d28ee82-2240-4f10-9db9-e966c0e62a13@googlegroups.com>
References <0d28ee82-2240-4f10-9db9-e966c0e62a13@googlegroups.com>
X-Mailer Claws Mail 3.8.1 (GTK+ 2.24.10; x86_64-pc-linux-gnu)
Mime-Version 1.0
Content-Type text/plain; charset=US-ASCII
Content-Transfer-Encoding 7bit
X-AuthUser tim@thechases.com
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.14260.1411480271.18130.python-list@python.org> (permalink)
Lines 30
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1411480271 news.xs4all.nl 2830 [2001:888:2000:d::a6]:32843
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:78211

Show key headers only | View raw


On 2014-09-23 05:34, 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).

Not that I know of -- the performance characteristics would differ
radically from the O(1) expectations that Counter() gives you since
you'd have to compare your value against *every* value in the
container[*], and you have the possibility that two items in the
container are equidistant yet within EPSILON:

  EPSILON = 0.51
  my_counter[1.0] += 1
  my_counter[2.0] += 1
  my_counter[1.5] += 1  # which one should be incremented?

-tkc


[*]
This could be mitigated if you had some constraints on your inputs
and wanted to do some sort of bucket-hashing, limiting it to a subset
of the possible keys




Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


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