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


Groups > comp.lang.python > #92207 > unrolled thread

Testing random

Started byCecil Westerhof <Cecil@decebal.nl>
First post2015-06-07 08:27 +0200
Last post2015-06-07 11:04 -0400
Articles 20 on this page of 80 — 22 participants

Back to article view | Back to comp.lang.python


Contents

  Testing random Cecil Westerhof <Cecil@decebal.nl> - 2015-06-07 08:27 +0200
    Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-07 12:40 +0200
      Re: Testing random Chris Angelico <rosuav@gmail.com> - 2015-06-07 21:51 +1000
        Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-07 17:51 +0200
          Re: Testing random Chris Angelico <rosuav@gmail.com> - 2015-06-08 02:25 +1000
            Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-07 18:36 +0200
              Re: Testing random Chris Angelico <rosuav@gmail.com> - 2015-06-08 02:44 +1000
                Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-07 20:23 +0200
                  Re: Testing random Chris Angelico <rosuav@gmail.com> - 2015-06-08 04:52 +1000
                    Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-07 21:41 +0200
                  Re: Testing random Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2015-06-07 22:08 +0300
                    Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-07 21:29 +0200
                      Re: Testing random random832@fastmail.us - 2015-06-07 15:44 -0400
                        Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-07 22:09 +0200
                          Re: Testing random random832@fastmail.us - 2015-06-07 16:41 -0400
                            Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-07 22:59 +0200
                            Re: Testing random Steven D'Aprano <steve@pearwood.info> - 2015-06-08 11:26 +1000
                            Re: Testing random random832@fastmail.us - 2015-06-07 21:34 -0400
                            Re: Testing random Chris Angelico <rosuav@gmail.com> - 2015-06-08 11:42 +1000
                            Re: Testing random MRAB <python@mrabarnett.plus.com> - 2015-06-08 02:49 +0100
                            Re: Testing random random832@fastmail.us - 2015-06-07 21:57 -0400
                      Re: Testing random Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2015-06-08 10:40 +0300
                        Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-10 19:03 +0200
                          Re: Testing random sohcahtoa82@gmail.com - 2015-06-10 10:52 -0700
                            Re: Testing random Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2015-06-10 23:00 +0300
                          Re: Testing random Ian Kelly <ian.g.kelly@gmail.com> - 2015-06-10 12:02 -0600
                            Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-12 23:32 +0200
                              Re: Testing random alister <alister.nospam.ware@ntlworld.com> - 2015-06-12 21:46 +0000
                              Re: Testing random random832@fastmail.us - 2015-06-12 17:52 -0400
                              Re: Testing random Ian Kelly <ian.g.kelly@gmail.com> - 2015-06-12 16:00 -0600
                                Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-13 00:09 +0200
                                  Re: Testing random sohcahtoa82@gmail.com - 2015-06-12 15:55 -0700
                                  Re: Testing random random832@fastmail.us - 2015-06-12 18:57 -0400
                              Re: Testing random Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-06-13 08:53 +0100
                          Re: Testing random random832@fastmail.us - 2015-06-10 14:26 -0400
                  Re: Testing random Ned Batchelder <ned@nedbatchelder.com> - 2015-06-07 14:21 -0700
                    Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-16 21:18 +0200
                      Re: Testing random random832@fastmail.us - 2015-06-16 16:23 -0400
                      Re: Testing random Ned Batchelder <ned@nedbatchelder.com> - 2015-06-16 13:48 -0700
                        Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-16 23:57 +0200
                          Re: Testing random sohcahtoa82@gmail.com - 2015-06-16 15:30 -0700
                            Re: Testing random Ian Kelly <ian.g.kelly@gmail.com> - 2015-06-16 16:58 -0600
                            Re: Testing random Laura Creighton <lac@openend.se> - 2015-06-17 11:28 +0200
                          Re: Testing random Ned Batchelder <ned@nedbatchelder.com> - 2015-06-16 16:26 -0700
                            Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-17 01:45 +0200
                              Re: Testing random sohcahtoa82@gmail.com - 2015-06-16 17:36 -0700
                                Re: Testing random Chris Angelico <rosuav@gmail.com> - 2015-06-17 11:01 +1000
                                Re: Testing random Ethan Furman <ethan@stoneleaf.us> - 2015-06-16 18:32 -0700
                                Re: Testing random Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-06-17 09:41 +0100
                                  Re: Testing random Grant Edwards <invalid@invalid.invalid> - 2015-06-17 14:04 +0000
                                    Re: Testing random Ian Kelly <ian.g.kelly@gmail.com> - 2015-06-17 09:01 -0600
                              Re: Testing random MRAB <python@mrabarnett.plus.com> - 2015-06-17 01:42 +0100
                                Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-17 08:53 +0200
                                  Re: Testing random Christian Gollwitzer <auriocus@gmx.de> - 2015-06-17 09:22 +0200
                                    Re: Testing random Chris Angelico <rosuav@gmail.com> - 2015-06-17 17:28 +1000
                                    Re: Testing random Tim Golden <mail@timgolden.me.uk> - 2015-06-17 08:30 +0100
                                      Re: Testing random Cecil Westerhof <Cecil@decebal.nl> - 2015-06-17 11:57 +0200
                              Re: Testing random Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-06-17 01:36 +0000
                              Re: Testing random Laura Creighton <lac@openend.se> - 2015-06-17 12:33 +0200
                                Re: Testing random Steven D'Aprano <steve@pearwood.info> - 2015-06-17 22:47 +1000
                                  Re: Testing random Laura Creighton <lac@openend.se> - 2015-06-17 15:50 +0200
                        Re: Testing random Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-06-17 01:35 +0000
                    Re: Testing random Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2015-06-17 07:41 +0300
                  Re: Testing random Steven D'Aprano <steve@pearwood.info> - 2015-06-08 11:11 +1000
              Re: Testing random Ian Kelly <ian.g.kelly@gmail.com> - 2015-06-07 11:07 -0600
              Re: Testing random Chris Angelico <rosuav@gmail.com> - 2015-06-08 03:20 +1000
              Re: Testing random "C.D. Reimer" <chris@cdreimer.com> - 2015-06-07 10:36 -0700
              Re: Testing random Steven D'Aprano <steve@pearwood.info> - 2015-06-08 04:28 +1000
                Re: Testing random Chris Angelico <rosuav@gmail.com> - 2015-06-08 04:40 +1000
          Re: Testing random Steven D'Aprano <steve@pearwood.info> - 2015-06-08 04:24 +1000
    Re: Testing random Jonas Wielicki <jonas@wielicki.name> - 2015-06-07 12:41 +0200
    Re: Testing random Steven D'Aprano <steve@pearwood.info> - 2015-06-07 22:52 +1000
      Re: Testing random Steven D'Aprano <steve@pearwood.info> - 2015-06-07 23:06 +1000
      Re: Testing random Peter Otten <__peter__@web.de> - 2015-06-07 15:35 +0200
        Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-07 18:36 +0200
          Re: Testing random Peter Otten <__peter__@web.de> - 2015-06-07 18:48 +0200
            Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-07 22:15 +0200
        Re: Testing random Steven D'Aprano <steve@pearwood.info> - 2015-06-08 11:35 +1000
    Re: Testing random Christian Gollwitzer <auriocus@gmx.de> - 2015-06-07 14:53 +0200
    Re: Testing random Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-06-07 11:04 -0400

Page 2 of 4 — ← Prev page 1 [2] 3 4  Next page →


#92323

Fromrandom832@fastmail.us
Date2015-06-07 21:57 -0400
Message-ID<mailman.287.1433728625.13271.python-list@python.org>
In reply to#92302
On Sun, Jun 7, 2015, at 21:42, Chris Angelico wrote:
> On Mon, Jun 8, 2015 at 11:34 AM,  <random832@fastmail.us> wrote:
> > In general, as the number of trials increases, the probability of having
> > e.g. at least one of each value never _reaches_ 1, but it gets
> > arbitrarily close.
> 
> And by "arbitrarily close", you mean any of:
> 
> * So close to 1.0 that IEEE double precision is unable to represent it
> * So unlikely that you could perform one trial every nanosecond until
> the heat death of the universe and still not expect to see it
> * Less likely than that two files could accidentally collide on MD5,
> SHA1, SHA256, and file size, simultaneously
> 
> I think all of the above are true of this case, though I have to guess
> about the heat death of the universe.

Well, yes (assuming, as you say, that the heat death of the universe is
a finite time). More precisely, "arbitrarily close" is a mathematical
term which means that for any desired distance from the limit, there is
an input that will cause the result to get closer. It's entirely
possible to select a number of symbols and a number of trials that won't
get you there.

I also think there may have been some confusion with some of us using
"trial" to refer to each individual random number, and some of us at
some times using it to refer to each attempt to generate a sequence of a
given length.

[toc] | [prev] | [next] | [standalone]


#92332

FromJussi Piitulainen <jpiitula@ling.helsinki.fi>
Date2015-06-08 10:40 +0300
Message-ID<lf5r3pmejgh.fsf@ling.helsinki.fi>
In reply to#92294
Thomas 'PointedEars' Lahn writes:
> Jussi Piitulainen wrote:
>> Thomas 'PointedEars' Lahn writes:
>>
>>>   8 3 6 3 1 2 6 8 2 1 6.
>> 
>> There are more than four hundred thousand ways to get those numbers
>> in some order.
>> 
>> (11! / 2! / 2! / 2! / 3! / 2! = 415800)
>
> Fallacy.  Order is irrelevant here.

You need to consider every sequence that leads to the observed counts.
One of those sequences occurred. You don't know which.

When tossing herrings into a fixed number of boxes (each time picking
the number of one of the boxes), the proportion of the ways to hit every
box at least once increases with the number of herrings as follows.

Proportions of occupying sequences of tosses into 3 boxes:
 2 herrings:  0% == 0 out of 9
 3 herrings: 22% == 6 out of 27
 4 herrings: 44% == 36 out of 81
 5 herrings: 62% == 150 out of 243
 6 herrings: 74% == 540 out of 729
 7 herrings: 83% == 1806 out of 2187
 8 herrings: 88% == 5796 out of 6561
 9 herrings: 92% == 18150 out of 19683
10 herrings: 95% == 55980 out of 59049
11 herrings: 97% == 171006 out of 177147
12 herrings: 98% == 519156 out of 531441

That's counting the sequences of box numbers, so those proportions can
be interpreted as probabilities (of occupying every box) under the
standard assumption that the sequences are equiprobable. The final
distributions of counts aren't. (How is this even counter-intuitive?)

Code follows. Incidentally, I'm not feeling smart here. I made several
quite stupid mistakes during this little experiment before I was happy
with it. Note that this actually walks through a combinatorial
explosion, so do not substitute much bigger parameters.

from itertools import product
from collections import Counter

boxes = 3
print('Proportions of occupying sequences of tosses into {} boxes:'
      .format(boxes))
for herrings in range(2, 13):
    winnings = sum(len(Counter(p)) == boxes
                   for p in product(range(boxes),
                                    repeat = herrings))
    print('{:>2} herrings:'.format(herrings),
          '{:>3.0%}'.format(winnings / (boxes ** herrings)),
          '== {} out of {}'.format(winnings, boxes ** herrings))

[toc] | [prev] | [next] | [standalone]


#92410

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2015-06-10 19:03 +0200
Message-ID<16299015.icEhCTIHP8@PointedEars.de>
In reply to#92332
Jussi Piitulainen wrote:

> Thomas 'PointedEars' Lahn writes:
>> Jussi Piitulainen wrote:
>>> Thomas 'PointedEars' Lahn writes:
>>>>   8 3 6 3 1 2 6 8 2 1 6.
>>> 
>>> There are more than four hundred thousand ways to get those numbers
>>> in some order.
>>> 
>>> (11! / 2! / 2! / 2! / 3! / 2! = 415800)
>>
>> Fallacy.  Order is irrelevant here.
> 
> You need to consider every sequence that leads to the observed counts.

No, you need _not_, because – I repeat – the probability of getting a 
sequence of length n from a set of 9 numbers whereas the probability of 
picking a number is evenly distributed, is (1∕9)ⁿ [(1/9)^n, or 1/9 to the 
nth, for those who do to see it because of lack of Unicode support at their 
system].  *Always.*  *No matter* which numbers are in it.  *No matter* in 
which order they are.  AISB, order is *irrelevant* here.  *Completely.*

This is _not_ a lottery box; you put the ball with the number on it *back 
into the box* after you have drawn it and before you draw a new one.

> One of those sequences occurred. You don't know which.

You do not have to.

> When tossing herrings […]

Herrings are the key word here, indeed, and they are deep dark red.

> Code follows. Incidentally, I'm not feeling smart here. 

Good.  Because you should not feel smart in any way after ignoring all my 
explanations.

> [nonsense]

-- 
PointedEars

Twitter: @PointedEars2
Please do not cc me. / Bitte keine Kopien per E-Mail.

[toc] | [prev] | [next] | [standalone]


#92417

Fromsohcahtoa82@gmail.com
Date2015-06-10 10:52 -0700
Message-ID<e4a78e74-ca31-4000-9239-e14df9b47fd0@googlegroups.com>
In reply to#92410
On Wednesday, June 10, 2015 at 10:06:49 AM UTC-7, Thomas 'PointedEars' Lahn wrote:
> Jussi Piitulainen wrote:
> 
> > Thomas 'PointedEars' Lahn writes:
> >> Jussi Piitulainen wrote:
> >>> Thomas 'PointedEars' Lahn writes:
> >>>>   8 3 6 3 1 2 6 8 2 1 6.
> >>> 
> >>> There are more than four hundred thousand ways to get those numbers
> >>> in some order.
> >>> 
> >>> (11! / 2! / 2! / 2! / 3! / 2! = 415800)
> >>
> >> Fallacy.  Order is irrelevant here.
> > 
> > You need to consider every sequence that leads to the observed counts.
> 
> No, you need _not_, because – I repeat – the probability of getting a 
> sequence of length n from a set of 9 numbers whereas the probability of 
> picking a number is evenly distributed, is (1∕9)ⁿ [(1/9)^n, or 1/9 to the 
> nth, for those who do to see it because of lack of Unicode support at their 
> system].  *Always.*  *No matter* which numbers are in it.  *No matter* in 
> which order they are.  AISB, order is *irrelevant* here.  *Completely.*
> 
> This is _not_ a lottery box; you put the ball with the number on it *back 
> into the box* after you have drawn it and before you draw a new one.
> 
> > One of those sequences occurred. You don't know which.
> 
> You do not have to.
> 
> > When tossing herrings […]
> 
> Herrings are the key word here, indeed, and they are deep dark red.
> 
> > Code follows. Incidentally, I'm not feeling smart here. 
> 
> Good.  Because you should not feel smart in any way after ignoring all my 
> explanations.
> 
> > [nonsense]
> 
> -- 
> PointedEars
> 
> Twitter: @PointedEars2
> Please do not cc me. / Bitte keine Kopien per E-Mail.

To put it another way, let's simplify the problem.  You're rolling a pair of dice.  What are the chances that you'll see a pair of 3s?

Look at the list of possible roll combinations:

1 1     1 2     1 3     1 4     1 5     1 6
2 1     2 2     2 3     2 4     2 5     2 6
3 1     3 2     3 3     3 4     3 5     3 6
4 1     4 2     4 3     4 4     4 5     4 6
5 1     5 2     5 3     5 4     5 5     5 6
6 1     6 2     6 3     6 4     6 5     6 6

36 possible combinations.  Only one of them has a pair of 3s.  The answer is 1/36.

What about the chances of seeing 2 1?

Here's where I think you two are having such a huge disagreement.  Does order matter?  It depends what you're pulling random numbers out for.

The odds of seeing 2 1 are also only 1/36.  But if order doesn't matter in your application, then 1 2 is equivalent.  The odds of getting 2 1 OR 1 2 is 2/36, or 1/18.

But whether order matters or not, the chances of getting a pair of threes in two rolls is ALWAYS 1/36.

If this gets expanded to grabbing 10 random numbers between 1 and 9, then the chances of getting a sequence of 10 ones is still only (1/9)^10, *regardless of whether or not order matters*.  There are 9^10 possible sequences, but only *one* of these is all ones.

If order matters, then 7385941745 also has a (1/9)^10 chance of occurring.  Just because it isn't a memorable sequence doesn't give it a higher chance of happening.

If order DOESN'T matter, then 1344557789 would be equivalent, and the odds are higher.

[toc] | [prev] | [next] | [standalone]


#92423

FromJussi Piitulainen <jpiitula@ling.helsinki.fi>
Date2015-06-10 23:00 +0300
Message-ID<lf5wpzb9vuz.fsf@ling.helsinki.fi>
In reply to#92417
sohcahtoa82@gmail.com writes:

[...]

> Here's where I think you two are having such a huge disagreement.
> Does order matter?  It depends what you're pulling random numbers out
> for.
>
> The odds of seeing 2 1 are also only 1/36.  But if order doesn't
> matter in your application, then 1 2 is equivalent.  The odds of
> getting 2 1 OR 1 2 is 2/36, or 1/18.

[...]

I'm not sure what Thomas 'PointedEars' Lahn is talking about. It seems
to be something else than what others have been discussing.

Others have been discussing a record of the number of times that each
possible outcome came up in a sequence of random numbers. There is no
other record of the sequence. The number of drawings is much larger than
the number of possible outcomes. The subject line refers to testing
whether the record of counts is compatible with the drawings being
random in the usual sense: independent, with uniform distribution.

Someone pointed out that some numbers may not have occurred at all - I
think a piece of code needed modification - and so people have commented
on the probability of this happening ... and whether it depends on the
number of drawings.

[toc] | [prev] | [next] | [standalone]


#92418

FromIan Kelly <ian.g.kelly@gmail.com>
Date2015-06-10 12:02 -0600
Message-ID<mailman.354.1433959416.13271.python-list@python.org>
In reply to#92410
On Wed, Jun 10, 2015 at 11:03 AM, Thomas 'PointedEars' Lahn
<PointedEars@web.de> wrote:
> Jussi Piitulainen wrote:
>
>> Thomas 'PointedEars' Lahn writes:
>>> Jussi Piitulainen wrote:
>>>> Thomas 'PointedEars' Lahn writes:
>>>>>   8 3 6 3 1 2 6 8 2 1 6.
>>>>
>>>> There are more than four hundred thousand ways to get those numbers
>>>> in some order.
>>>>
>>>> (11! / 2! / 2! / 2! / 3! / 2! = 415800)
>>>
>>> Fallacy.  Order is irrelevant here.
>>
>> You need to consider every sequence that leads to the observed counts.
>
> No, you need _not_, because – I repeat – the probability of getting a
> sequence of length n from a set of 9 numbers whereas the probability of
> picking a number is evenly distributed, is (1∕9)ⁿ [(1/9)^n, or 1/9 to the
> nth, for those who do to see it because of lack of Unicode support at their
> system].  *Always.*  *No matter* which numbers are in it.  *No matter* in
> which order they are.  AISB, order is *irrelevant* here.  *Completely.*

Order is relevant because, for instance, there are n differently
ordered sequences that contain n-1 1s and one 2, while there is only
one sequence that contains n 1s. While each of those individual
sequences are indeed equiprobable, the overall probability of getting
a sequence that contains n-1 1s and one 2 is n times the probability
of getting a sequence that contains n 1s.

The context of this whole thread is about the probability of getting a
sequence where every number occurs at least once. The order that they
occur in doesn't matter, but the number of possible permutations does,
because every one of those permutations is a distinct sequence
contributing an equal amount to the total overall probability.

The probability of 123456789 and 111111111 are equal. The probability
of a sequence containing all nine numbers and a sequence containing
only 1s are *not* equal.

[toc] | [prev] | [next] | [standalone]


#92555

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2015-06-12 23:32 +0200
Message-ID<1481051.eNy53rHVEB@PointedEars.de>
In reply to#92418
Ian Kelly wrote:

> The probability of 123456789 and 111111111 are equal. The probability
> of a sequence containing all nine numbers and a sequence containing
> only 1s are *not* equal.

There is a contradiction in that statement.  Can you find it?

-- 
PointedEars

Twitter: @PointedEars2
Please do not cc me. / Bitte keine Kopien per E-Mail.

[toc] | [prev] | [next] | [standalone]


#92556

Fromalister <alister.nospam.ware@ntlworld.com>
Date2015-06-12 21:46 +0000
Message-ID<mlfjve$n5i$1@speranza.aioe.org>
In reply to#92555
On Fri, 12 Jun 2015 23:32:31 +0200, Thomas 'PointedEars' Lahn wrote:

> Ian Kelly wrote:
> 
>> The probability of 123456789 and 111111111 are equal. The probability
>> of a sequence containing all nine numbers and a sequence containing
>> only 1s are *not* equal.
> 
> There is a contradiction in that statement.  Can you find it?

i am afraid ther is not

there is only one probibility that will give 111111111 there are a huge 
number of combinations that contain all 9 digits

123456789 & 987654321 to name but 2

there are vastly more combinations that contain all 9 digits (9!) even 
though the chances of any one sequence is still the same as 111111111  


-- 
When in a hole, stop diging

[toc] | [prev] | [next] | [standalone]


#92557

Fromrandom832@fastmail.us
Date2015-06-12 17:52 -0400
Message-ID<mailman.441.1434145951.13271.python-list@python.org>
In reply to#92555
On Fri, Jun 12, 2015, at 17:32, Thomas 'PointedEars' Lahn wrote:
> Ian Kelly wrote:
> 
> > The probability of 123456789 and 111111111 are equal. The probability
> > of a sequence containing all nine numbers and a sequence containing
> > only 1s are *not* equal.
> 
> There is a contradiction in that statement.  Can you find it?

There is not.

The probability of 111111111 is ~0.000000002581, given each digit is
chosen from 1 to 9.

The probability of 123456789 is ~0.000000002581.
The probability of 123456798 is ~0.000000002581.
The probability of 123456879 is ~0.000000002581.
The probability of 123456897 is ~0.000000002581.
The probability of 123456978 is ~0.000000002581.
The probability of 123456987 is ~0.000000002581.
The probability of 123456897 is ~0.000000002581.
The probability of 123457689 is ~0.000000002581.
The probability of 123457698 is ~0.000000002581.
And so on, for a total of 362,880 combinations.

The probability of getting one of these combinations is ~0.000936656708

~0.000936656708 is not equal to ~0.000000002581. QED.

Your problem is that you _continually insist_ on interpreting
"probability of a member of this set" as meaning "probability of one
particular member of this set" rather than "probability of any member of
this set".

It's like claiming the probability of getting a digit from 1 to 3 when
you roll a six-sided die is ~0.1667 instead of 0.5, and playing stupid
when people point out why you're wrong. And it's not even defensible as
an honest misunderstanding because the linguistic ambiguity doesn't
exist in the original claim about the limit probability of full
coverage.

[toc] | [prev] | [next] | [standalone]


#92558

FromIan Kelly <ian.g.kelly@gmail.com>
Date2015-06-12 16:00 -0600
Message-ID<mailman.442.1434146468.13271.python-list@python.org>
In reply to#92555
On Fri, Jun 12, 2015 at 3:32 PM, Thomas 'PointedEars' Lahn
<PointedEars@web.de> wrote:
> Ian Kelly wrote:
>
>> The probability of 123456789 and 111111111 are equal. The probability
>> of a sequence containing all nine numbers and a sequence containing
>> only 1s are *not* equal.
>
> There is a contradiction in that statement.  Can you find it?

Yes. I phrased my statement as if I were addressing a rational
individual, in clear contradiction of the current evidence.

Seriously, if you reject even the statement I made above, in spite of
all the arguments that have been advanced in this thread, in spite of
the fact that this is very easy to demonstrate empirically, then I
don't think there's any fertile ground for discussion here.

[toc] | [prev] | [next] | [standalone]


#92559

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2015-06-13 00:09 +0200
Message-ID<4021290.WxLfFvsQIG@PointedEars.de>
In reply to#92558
Ian Kelly wrote:

> […] Thomas 'PointedEars' Lahn […] wrote:
>> Ian Kelly wrote:
>>> The probability of 123456789 and 111111111 are equal. The probability
>>> of a sequence containing all nine numbers and a sequence containing
>>> only 1s are *not* equal.d
>> There is a contradiction in that statement.  Can you find it?
> 
> Yes. I phrased my statement as if I were addressing a rational
> individual, in clear contradiction of the current evidence.
> 
> Seriously, if you reject even the statement I made above, in spite of
> all the arguments that have been advanced in this thread, in spite of
> the fact that this is very easy to demonstrate empirically, then I
> don't think there's any fertile ground for discussion here.

/Ad hominem/ when out of arguments.  How typical.

Do you deny that “123456789” *is* “a sequence containing all nine numbers” 
(digits, really), and that “111111111” *is* “a sequence containing only 1s”?

Do you deny that therefore your second sentence contradicts the first one?

-- 
PointedEars

Twitter: @PointedEars2
Please do not cc me. / Bitte keine Kopien per E-Mail.

[toc] | [prev] | [next] | [standalone]


#92562

Fromsohcahtoa82@gmail.com
Date2015-06-12 15:55 -0700
Message-ID<bb47ddf4-7ca1-4b6f-affb-50e2f45825df@googlegroups.com>
In reply to#92559
On Friday, June 12, 2015 at 3:12:26 PM UTC-7, Thomas 'PointedEars' Lahn wrote:
> Ian Kelly wrote:
> 
> > [...] Thomas 'PointedEars' Lahn [...] wrote:
> >> Ian Kelly wrote:
> >>> The probability of 123456789 and 111111111 are equal. The probability
> >>> of a sequence containing all nine numbers and a sequence containing
> >>> only 1s are *not* equal.d
> >> There is a contradiction in that statement.  Can you find it?
> > 
> > Yes. I phrased my statement as if I were addressing a rational
> > individual, in clear contradiction of the current evidence.
> > 
> > Seriously, if you reject even the statement I made above, in spite of
> > all the arguments that have been advanced in this thread, in spite of
> > the fact that this is very easy to demonstrate empirically, then I
> > don't think there's any fertile ground for discussion here.
> 
> /Ad hominem/ when out of arguments.  How typical.
> 
> Do you deny that "123456789" *is* "a sequence containing all nine numbers" 
> (digits, really), and that "111111111" *is* "a sequence containing only 1s"?
> 
> Do you deny that therefore your second sentence contradicts the first one?
> 
> -- 
> PointedEars
> 
> Twitter: @PointedEars2
> Please do not cc me. / Bitte keine Kopien per E-Mail.

I'm struggling to see the contradiction here.

Yes, 123456789 is a sequence containing all nine numbers.  And as someone else said, 123456798 is also a sequence containing all numbers.  987654321 contains all numbers.  There are 9*8*7*6*5*4*3*2*1 (Usually expressed as "9!", and equal to 362,880) distinct ways to order nine numbers.

However, there is only ONE way to order a series of all 1s.

There's no contradiction here.

[toc] | [prev] | [next] | [standalone]


#92563

Fromrandom832@fastmail.us
Date2015-06-12 18:57 -0400
Message-ID<mailman.444.1434149867.13271.python-list@python.org>
In reply to#92559
On Fri, Jun 12, 2015, at 18:09, Thomas 'PointedEars' Lahn wrote:
> Do you deny that “123456789” *is* “a sequence containing all nine
> numbers”

Do you deny that "123456798" *is* "a sequence containing all nine
numbers"?

Does this mean that "123456789" *is* "123456798" by the transitive
property? NO.

There are multiple different meanings of the word "is" here, and the
particular one that applies here does not mean it can be substituted for
the more general description in a sentence about the probability of
getting a member of the set of such sequences.

[toc] | [prev] | [next] | [standalone]


#92586

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2015-06-13 08:53 +0100
Message-ID<mailman.454.1434182061.13271.python-list@python.org>
In reply to#92555
On 12/06/2015 23:00, Ian Kelly wrote:
> On Fri, Jun 12, 2015 at 3:32 PM, Thomas 'PointedEars' Lahn
> <PointedEars@web.de> wrote:
>> Ian Kelly wrote:
>>
>>> The probability of 123456789 and 111111111 are equal. The probability
>>> of a sequence containing all nine numbers and a sequence containing
>>> only 1s are *not* equal.
>>
>> There is a contradiction in that statement.  Can you find it?
>
> Yes. I phrased my statement as if I were addressing a rational
> individual, in clear contradiction of the current evidence.

Beautifully put, hence +1 QOTW.

>
> Seriously, if you reject even the statement I made above, in spite of
> all the arguments that have been advanced in this thread, in spite of
> the fact that this is very easy to demonstrate empirically, then I
> don't think there's any fertile ground for discussion here.
>

Congratulations Thomas 'PointedEars' Lahn, you've been promoted to my 
dream team.

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

[toc] | [prev] | [next] | [standalone]


#92420

Fromrandom832@fastmail.us
Date2015-06-10 14:26 -0400
Message-ID<mailman.356.1433960763.13271.python-list@python.org>
In reply to#92410
On Wed, Jun 10, 2015, at 13:03, Thomas 'PointedEars' Lahn wrote:
> This is _not_ a lottery box; you put the ball with the number on it *back 
> into the box* after you have drawn it and before you draw a new one.

Yes, but getting a 2, putting it back, and getting a 1 is just as good
as getting a 1, putting it back, and getting a 2, so you have to add the
probability of those cases together to get the probability of getting at
least one 1 and at least one 2.

[toc] | [prev] | [next] | [standalone]


#92307

FromNed Batchelder <ned@nedbatchelder.com>
Date2015-06-07 14:21 -0700
Message-ID<88ba163e-74f4-40fa-ab3e-1feeb051b961@googlegroups.com>
In reply to#92283
On Sunday, June 7, 2015 at 2:26:02 PM UTC-4, Thomas 'PointedEars' Lahn wrote:
> Chris Angelico wrote:
> 
> > On Mon, Jun 8, 2015 at 2:36 AM, Thomas 'PointedEars' Lahn
> > <PointedEars@web.de> wrote:
> >>> The greater the multiplier, the lower the chance that any element will
> >>> have no hits.
> >> Wrong.
> >>
> >>> [ex falso quodlibet]
> > 
> > Huh. Do you want to explain how, mathematically, I am wrong, or do you
> > want to join the RUE in my ignore list?
> 
> I already did; you have overlooked it.  In a nutshell, the probability of 
> 
>   1 1 1 1 1 1 1 1 1 1 1
> 
> is *the same* as that of
> 
>   1 2 3 4 5 6 7 8 9 1 2
> 
> and the same as that of
> 
>   8 3 6 3 1 2 6 8 2 1 6.
> 

You aren't agreeing because you are arguing about different things.
Thomas is talking about the relative probability of sequences of digits.
Chris is talking about the probability of a single digit never appearing
in the output.

Thomas: let's say I generate streams of N digits drawn randomly from 0-9.  
I then consider the probability of a zero *never appearing once* in my
stream.  Let's call that P(N).  Do you agree that as N increases, P(N)
decreases?

--Ned.

[toc] | [prev] | [next] | [standalone]


#92695

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2015-06-16 21:18 +0200
Message-ID<17701105.fuEQZlnPee@PointedEars.de>
In reply to#92307
Ned Batchelder wrote:

> You aren't agreeing because you are arguing about different things.
> Thomas is talking about the relative probability of sequences of digits.

There is no such thing as “relative probability”, except perhaps in popular-
scientific material and bad translations.  You might mean relative 
_frequency_, but I was not talking about that specifically.

> Chris is talking about the probability of a single digit never appearing
> in the output.

I do not think that what I am talking about and what you think Chris is 
talking about are different things.

> Thomas: let's say I generate streams of N digits drawn randomly from 0-9.
> I then consider the probability of a zero *never appearing once* in my
> stream.  Let's call that P(N)
 
In probability theory, it is called the probability P(E) of the event E that 
in n trials the probability variable X never assumes the value 0, which can 
be defined as

  P(E), E = {e_i | n ∈ ℕ \ {0}, i = 1, …, n} \ {X ≠ 0}, Ω = {1, 2, …, 9} 

where the e_i are the singular events, or outcomes, of the probabilistic 
experiment, and Ω is the sample space of the e_i.

> Do you agree that as N increases, P(N) decreases?

I do not agree that P(E), as defined above, decreases as n increases.

See also: <http://rationalwiki.org/wiki/Gambler%27s_fallacy>

-- 
PointedEars

Twitter: @PointedEars2
Please do not cc me. / Bitte keine Kopien per E-Mail.

[toc] | [prev] | [next] | [standalone]


#92698

Fromrandom832@fastmail.us
Date2015-06-16 16:23 -0400
Message-ID<mailman.526.1434486230.13271.python-list@python.org>
In reply to#92695
On Tue, Jun 16, 2015, at 15:18, Thomas 'PointedEars' Lahn wrote:
> There is no such thing as “relative probability”, except perhaps in
> popular-
> scientific material and bad translations.  You might mean relative 
> _frequency_, but I was not talking about that specifically.

The probability of one event (getting a red on a roulette wheel) can be
larger than the probability of another event (getting a 17).

This is the plain english sense of the word "relative".


You have not answered my last question:


On Fri, Jun 12, 2015, at 18:57, random832@fastmail.us wrote:
> On Fri, Jun 12, 2015, at 18:09, Thomas 'PointedEars' Lahn wrote:
> > Do you deny that “123456789” *is* “a sequence containing all nine
> > numbers”
> 
> Do you deny that "123456798" *is* "a sequence containing all nine
> numbers"?
> 
> Does this mean that "123456789" *is* "123456798" by the transitive
> property? NO.

The temperature today is hot. The temperature tomorrow is also hot. This
is true even if the temperature today is (for example) 37 and the
temperature tomorrow is 35.

[toc] | [prev] | [next] | [standalone]


#92699

FromNed Batchelder <ned@nedbatchelder.com>
Date2015-06-16 13:48 -0700
Message-ID<ff4a8ffd-50fe-4705-b33a-fcf63bcccc11@googlegroups.com>
In reply to#92695
On Tuesday, June 16, 2015 at 3:21:46 PM UTC-4, Thomas 'PointedEars' Lahn wrote:
> Ned Batchelder wrote:
> 
> > You aren't agreeing because you are arguing about different things.
> > Thomas is talking about the relative probability of sequences of digits.
> 
> There is no such thing as “relative probability”, except perhaps in popular-
> scientific material and bad translations.  You might mean relative 
> _frequency_, but I was not talking about that specifically.
> 
> > Chris is talking about the probability of a single digit never appearing
> > in the output.
> 
> I do not think that what I am talking about and what you think Chris is 
> talking about are different things.
> 
> > Thomas: let's say I generate streams of N digits drawn randomly from 0-9.
> > I then consider the probability of a zero *never appearing once* in my
> > stream.  Let's call that P(N)
>  
> In probability theory, it is called the probability P(E) of the event E that 
> in n trials the probability variable X never assumes the value 0, which can 
> be defined as
> 
>   P(E), E = {e_i | n ∈ ℕ \ {0}, i = 1, …, n} \ {X ≠ 0}, Ω = {1, 2, …, 9} 
> 
> where the e_i are the singular events, or outcomes, of the probabilistic 
> experiment, and Ω is the sample space of the e_i.
> 
> > Do you agree that as N increases, P(N) decreases?
> 
> I do not agree that P(E), as defined above, decreases as n increases.
> 
> See also: <http://rationalwiki.org/wiki/Gambler%27s_fallacy>

I apologize, I'm sure I've been using the mathematical terms imprecisely.
We are all intelligent people, so I still believe we disagree because we
are talking about different things.

To put us all on a footing where (I hope) we have a shared understanding,
this Python program demonstrates what I was talking about:



import random

def die_roll():
    """Roll the die once, produce a number 0-9."""
    return random.randint(0, 9)

def die_rolls(n):
    """Roll the die n times, produce a list of numbers from 0-9."""
    return [die_roll() for _ in xrange(n)]

def any_zeros(seq):
    """Is there any zero in `seq`?"""
    return any(x == 0 for x in seq)

def probability_of_no_zero(nrolls, nseq):
    """Determine the chance of no zero in a sequence of rolls.

    This is done empirically, by producing `nseq` sequences of
    `nrolls` rolls of the die.  Each sequence is examined to
    see if it has a zero.  The total number of no-zero
    sequences divided `nseq` is the probability.
    """
    no_zeros = 0
    for _ in xrange(nseq):
        seq = die_rolls(nrolls)
        if not any_zeros(seq):
            no_zeros += 1
    return float(no_zeros)/nseq

for n in range(10, 101, 10):
    # Calculate the probability of getting no zeros by trying
    # it a million times.
    prob = probability_of_no_zero(n, 1000000)
    print "n = {:3d}, P(no zero) = {:.8f}".format(n, prob)



Running this gives:

$ pypy testrandom.py
n =  10, P(no zero) = 0.34867300
n =  20, P(no zero) = 0.12121900
n =  30, P(no zero) = 0.04267000
n =  40, P(no zero) = 0.01476600
n =  50, P(no zero) = 0.00519900
n =  60, P(no zero) = 0.00174100
n =  70, P(no zero) = 0.00061600
n =  80, P(no zero) = 0.00020600
n =  90, P(no zero) = 0.00006300
n = 100, P(no zero) = 0.00002400


As n increases, the probability of having no zeros goes down.

--Ned.

[toc] | [prev] | [next] | [standalone]


#92703

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2015-06-16 23:57 +0200
Message-ID<2089101.KkvqnN9Xah@PointedEars.de>
In reply to#92699
Ned Batchelder wrote:

> […]
>     This is done empirically, by producing `nseq` sequences of
>     `nrolls` rolls of the die.  Each sequence is examined to
>     see if it has a zero.  The total number of no-zero
>     sequences divided `nseq` is the probability.

No, it is not.  It is the relative frequency for *this* number of trials and 
*this* run of the experiment.

>     """
>     no_zeros = 0
>     for _ in xrange(nseq):
>         seq = die_rolls(nrolls)
>         if not any_zeros(seq):
>             no_zeros += 1
>     return float(no_zeros)/nseq
> 
> for n in range(10, 101, 10):
>     # Calculate the probability of getting no zeros by trying
>     # it a million times.
>     prob = probability_of_no_zero(n, 1000000)
>     print "n = {:3d}, P(no zero) = {:.8f}".format(n, prob)
> 
> 
> 
> Running this gives:
> 
> $ pypy testrandom.py
> n =  10, P(no zero) = 0.34867300
> n =  20, P(no zero) = 0.12121900
> n =  30, P(no zero) = 0.04267000
> n =  40, P(no zero) = 0.01476600
> n =  50, P(no zero) = 0.00519900
> n =  60, P(no zero) = 0.00174100
> n =  70, P(no zero) = 0.00061600
> n =  80, P(no zero) = 0.00020600
> n =  90, P(no zero) = 0.00006300
> n = 100, P(no zero) = 0.00002400
> 
> 
> As n increases, the probability of having no zeros goes down.

Your programmatic "proof", as all the other intuitive-empirical "proofs", 
and all the other counter-arguments posted before in this thread, is flawed.  
As others have pointed out at the beginning of this thread, you *cannot* 
measure or calculate probability or determine randomness programmatically 
(at least not with this program).  I repeat: Probability is what relative 
frequency (which you can measure) *approaches* for *large* numbers.  100 is 
anything but large, to begin with.  What is “large” depends on the 
experiment, not on the experimentator.  And with independent events, the 
probability for getting zero does not increase because you have been getting 
non-zeros before.  It simply does not work this way.

If you had read the article I referred you to, you would have known that 
this approach, this program, is bogus.  I see no logic to continue here as 
long as you do not realize and recognize the Gambler’s fallacy on which all 
arguments presented so far, including yours, are based.  I would only be 
wasting more precious free time by repeating myself in one way or another.

This should give you pause: In real mathematics, events with zero 
probability can occur.

-- 
PointedEars

Twitter: @PointedEars2
Please do not cc me. / Bitte keine Kopien per E-Mail.

[toc] | [prev] | [next] | [standalone]


Page 2 of 4 — ← Prev page 1 [2] 3 4  Next page →

Back to top | Article view | comp.lang.python


csiph-web