Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.079 X-Spam-Evidence: '*H*': 0.84; '*S*': 0.00; 'input,': 0.09; '23,': 0.16; 'exist.': 0.16; 'item)': 0.16; 'appropriate': 0.16; 'wrote:': 0.18; 'advance.': 0.19; 'example': 0.22; 'creating': 0.23; 'header:In-Reply-To:1': 0.27; "doesn't": 0.30; 'message- id:@mail.gmail.com': 0.30; 'usually': 0.31; 'closer': 0.31; 'sep': 0.31; 'guess': 0.33; 'actual': 0.34; "i'd": 0.34; 'could': 0.34; 'problem': 0.35; "can't": 0.35; 'definition': 0.35; 'equal': 0.35; 'received:google.com': 0.35; 'subject:?': 0.36; 'depends': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'previous': 0.38; 'subject:" ': 0.39; 'to:addr:python.org': 0.39; "you're": 0.61; 'first': 0.61; "you'll": 0.62; 'here': 0.66; 'determine': 0.67 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=Z5Y6dwmUh+7n9cs/09WdGR4jjWLnzEt1Ci3UmXlVxpE=; b=W3DhaGVm41xtbHBubZiqKU/vs4jhE3KaZ1WMIY4TPPP128u0HU9IhB0I9GeHA+d2K3 LKed9i+3Y5g5r0Yq59uYKddNFb1MzrswEbgGT8eAvAneAd+MBGHaiyVPiQV8Hm5RdQ+D vqFwnuyB4pIXmPlnEQ7N08G3DE0Sc8I0yRE6I900htW+3tVtDU6gOno69gp9uWkUyKLh xOIGac3EUtVNu/M8O8cW2D92txCXKFiSrvQzK+4a8aZj0dtJBNfWE0V+5f6F3js4Qhma xdP/lEQ+XHNEUL5a6F46b5nmnC1HJJQkpvRCap77WkrUVwO8JgPp8WrvgUDkEeyi9uaX dHtQ== X-Received: by 10.194.209.207 with SMTP id mo15mr8506832wjc.6.1411570618319; Wed, 24 Sep 2014 07:56:58 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <1a63fb8d-e0b8-4385-acbc-ddb6bf1f0f7d@googlegroups.com> References: <0d28ee82-2240-4f10-9db9-e966c0e62a13@googlegroups.com> <20140923093244.066bb10b@rg.highlandtechnology.com> <1a63fb8d-e0b8-4385-acbc-ddb6bf1f0f7d@googlegroups.com> From: Ian Kelly Date: Wed, 24 Sep 2014 08:56:18 -0600 Subject: Re: "Fuzzy" Counter? To: Python Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1411570620 news.xs4all.nl 2967 [2001:888:2000:d::a6]:45540 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:78293 On Tue, Sep 23, 2014 at 11:01 PM, Miki Tebeka wrote: > On Tuesday, September 23, 2014 7:33:06 PM UTC+3, Rob Gaddi wrote: > >> 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. > The problem for me here is that I can't determine the number of bins in advance. I'd like to get frequencies. I guess every "new" (don't have any previous equal item) can be a bin. Then your result depends on the order of your input, which is usually not a good thing. Why would you need to determine the *number* of bins in advance? You just need to determine where they start and stop. If for example your epsilon is 0.5, you could determine the bins to be at [-0.5, 0.5); [0.5, 1.5); [1.5, 2.5); ad infinitum. Then for each actual value you encounter, you could calculate the appropriate bin, creating it first if it doesn't already exist.