top | item 37205576

(no title)

ksaho | 2 years ago

I was lazy so I just did:

import itertools as itools

xs = [f'{i}-{j}' for i in range(30) for j in range(12)]

ys = ['b', 'g']

zs = list(itools.product(xs, ys))

boys = [z for z in zs if z[1] == 'b']

len(boys)/len(zs)

----

gives me 0.5, or 1/2.

The moral of the article is to set up your universal set correctly and do not throw out any information, now matter how irrelevant.

discuss

order

wruza|2 years ago

Now I tell you I have two children, and (at least) one of them is a boy born on April 1st, has medium-length black hair, is 4'2", interested in 5 out of 12000 available rpg games, has 8 close friends and sword-shaped fingernails.

I believe your script may require a datacenter and a scalable architecture now.

phalf|2 years ago

And what do you do with non-discrete attributes?

phalf|2 years ago

But that's exactly what you did! You just counted which fraction of all kids is boys. You threw away that this is about pairs of kids, about april 1 on which one of them has their birthday and is a boy, and we want to know the sex of the other one. You already simplified by applying symmetry reductions. You could have just done print(1/2) and proclaimed that the output was 0.5 which therefore must be the solution.

p1esk|2 years ago

But in this case the moral of the article is exactly the opposite - if you throw out the irrelevant information the answer becomes trivial (no need for your calculations).