[ExI] It's simply obvious, right?
Jef Allbright
jef at jefallbright.net
Sun Nov 25 22:15:56 UTC 2007
On 11/25/07, Alejandro Dubrovsky <alito at organicrobot.com> wrote:
> On Sat, 2007-11-24 at 07:43 -0800, Jef Allbright wrote:
> > This TED video illustrates a difficulty at the core of much futurist discussion.
> >
> > The subject is not new, but it might as well be, for the resounding
> > lack of progress acquiring an intuitive grasp of reasoning about
> > uncertainty.
> >
> [snip]
> > <http://www.ted.com/index.php/talks/view/id/67>
>
> Thanks Jef for that link. While the message is about the general
> suckiness of humanity in understanding probability, I was struck by the
> specifics of the result of the first example too much to pay much
> attention to the rest of the video (which was more familiar to me).
Alejandro, thanks for your response and your interest.
Actually (and I didn't make it clear), I was trying to accomplish two
things with that post: (1) Get people thinking about the general
state of statistical illiteracy, and (2) challenge people to work
through why Bayes is so important.
The opening puzzle was only incidental to my interest. Anyway, your
response kindled a little more interest in me so I wrote my own
program and did a little more experimenting.
Results (10,000,000 tosses)
String: TT Average: 6.00
String: HT Average: 4.00
String: HTT Average: 8.00
String: HTH Average: 10.00
String: HTTT Average: 16.01
String: HTHT Average: 20.02
String: HTTTT Average: 32.02
String: HTHTH Average: 41.97
Here's my code for anyone who's interested:
#!/usr/bin/env python
from __future__ import division
import random, re
input = ['HTT', 'HTH']
output = []
N = 100000
def process_matches(s):
intervals = []
offset = 0
for index, m in enumerate(re.finditer(s, seq)):
current = m.start() - offset; offset = m.start()
intervals.append(current)
if index and not(index % 1000): print '.',
return sum(intervals) / len(intervals)
print 'Creating pseudo-random sequence of %i tosses...' % N
seq = ''.join([random.choice(['H', 'T']) for i in range(N)])
for inp in input:
print '\nMatching %s.' % inp,
output.append((inp, process_matches(inp)))
print '\n'
for outp in output:
print 'String: %s\tAverage: %.2f' % (outp)
[END]
More information about the extropy-chat
mailing list