Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #21933
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'python.': 0.04; 'python': 0.08; 'mentions': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'am,': 0.12; 'case.': 0.15; 'alternative,': 0.16; 'bieber': 0.16; 'constants': 0.16; 'declaimed': 0.16; 'email addr:ix.netcom.com': 0.16; 'email name:wlfraed': 0.16; 'finney': 0.16; 'from:addr:ix.netcom.com': 0.16; 'from:addr:wlfraed': 0.16; 'from:name:dennis lee bieber': 0.16; 'kern': 0.16; 'previously,': 0.16; 'received:wlfraed': 0.16; 'url:netcom': 0.16; 'url:wlfraed': 0.16; 'wulfraed': 0.16; 'wrote:': 0.18; 'later': 0.19; 'url:home': 0.21; 'maybe': 0.21; "doesn't": 0.22; '(or': 0.22; 'unlikely': 0.23; 'index': 0.24; 'suspect': 0.24; 'writes:': 0.25; '(in': 0.26; 'module': 0.26; 'server.': 0.28; 'project,': 0.28; 'random': 0.28; 'explicitly': 0.29; 'definition': 0.30; '(since': 0.30; 'context,': 0.30; 'ran': 0.30; 'actually': 0.31; 'rest': 0.32; 'requests': 0.32; 'tue,': 0.32; 'list': 0.32; 'match': 0.34; 'header:X-Complaints-To:1': 0.34; 'coding': 0.34; 'lee': 0.34; 'to:addr:python-list': 0.35; 'something': 0.35; 'project': 0.35; 'question': 0.36; 'received:org': 0.36; 'but': 0.37; 'skip:" 10': 0.37; 'using': 0.37; 'received:76': 0.37; 'mathematical': 0.38; 'some': 0.38; 'doing': 0.38; 'should': 0.38; 'relatively': 0.39; 'to:addr:python.org': 0.40; 'selection': 0.40; 'more': 0.61; 'your': 0.61; 'dennis': 0.73 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Dennis Lee Bieber <wlfraed@ix.netcom.com> |
| Subject | Re: Distribution |
| Date | Tue, 20 Mar 2012 11:29:37 -0400 |
| Organization | > Bestiaria Support Staff < |
| References | <33044d51-c481-4796-a722-406f412cf994@x7g2000pbi.googlegroups.com> <877gyfmsbl.fsf@benfinney.id.au> <jk9rhh$sn9$1@dough.gmane.org> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | 8bit |
| X-Gmane-NNTP-Posting-Host | adsl-76-253-99-231.dsl.klmzmi.sbcglobal.net |
| X-Newsreader | Forte Agent 3.3/32.846 |
| X-No-Archive | YES |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://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 | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.832.1332257387.3037.python-list@python.org> (permalink) |
| Lines | 46 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1332257387 news.xs4all.nl 6885 [2001:888:2000:d::a6]:54480 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:21933 |
Show key headers only | View raw
On Tue, 20 Mar 2012 12:00:50 +0000, Robert Kern <robert.kern@gmail.com>
declaimed the following in gmane.comp.python.general:
> On 3/20/12 11:21 AM, Ben Finney wrote:
> > "prince.pangeni"<prince.ram85@gmail.com> writes:
> >
> >> I am doing a simulation project using Python. In my project, I want
> >> to use some short of distribution to generate requests to a server.
> >
> > What is a distribution? That term already means something in Python
> > jargon, and it doesn't match the rest of your use case.
> >
> > So what do you mean by “distribution”? Maybe we can find a less
> > confusing term.
>
> Judging from the context, he means a probability distribution.
>
Futhermore, he explicitly mentions Poisson later in the text.
That should just be a case of finding the mathematical definition of
the distribution and coding something using random (since the random
module has gaussian/normal, but not Poisson -- maybe numpy/simpy?) to
obtain the time variant.
I suspect the real question is how to handle the weighted selection
of r1-r3. And for such a relatively short sample set (90 entries), the
chunked list shown previously, with randint to index into it is viable.
The alternative, more generalized (in a way), would be to use a
sorted list of the probabilities (or sums)... (pseudo-code)
probs = [ (numR1, r1),
(numR1 + numR2, r2),
(numR1 + numR2 + numR3, r3) ]
#obviously one is unlikely to actually create constants for the numRs
#more likely to create in line
probs.sort()
ran = random.randint(numR1 + numR2 + numR3)
for (p, r) in probs:
if ran > p: continue
theR = r
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Distribution "prince.pangeni" <prince.ram85@gmail.com> - 2012-03-19 21:31 -0700
Re: Distribution Peter Otten <__peter__@web.de> - 2012-03-20 10:15 +0100
Re: Distribution Ben Finney <ben+python@benfinney.id.au> - 2012-03-20 22:21 +1100
Re: Distribution Robert Kern <robert.kern@gmail.com> - 2012-03-20 12:00 +0000
Re: Distribution Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-03-20 11:29 -0400
Re: Distribution Laurent Claessens <moky.math@gmail.com> - 2012-03-20 18:00 +0100
Re: Distribution Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-03-20 13:47 -0400
Re: Distribution Robert Kern <robert.kern@gmail.com> - 2012-03-20 12:52 +0000
Re: Distribution duncan smith <buzzard@urubu.freeserve.co.uk> - 2012-03-20 20:19 +0000
csiph-web