Probability and statistics

#1

URL: http://en.diveintodeeplearning.org/chapter_crashcourse/probability.html

#2

In the third calculation in section 2.6.3: Pr(D1=1 and D2=1)=0.0001⋅0.9985+0.98⋅0.0015=0.00176955, Pr(D1=1 and D2=1|H=0) is 0.0003 as calculated in the first equation, not 0.0001, although the final result is right:)

#3

Hi, I would like to understand the output of this print(nd.random.multinomial(probabilities, shape=(10))) [3 5 2 3 3 2 2 1 5 0]

It is 10 times roll of a dice. So is the output saying 1 was rolled 3 times, 2 for 5 and so on till 6 ? or it is returning the output of each dice roll (but then it also gives a 0)
Thank you

#4

@saruvora,

It is 10 times roll of a die. This array is the actual outputs. In this example, the numbers on the die go from 0 to 5, not 1 to 6 compared to an actual physical die.

Effectively in your example, you rolled:
first a 3, then a 5, then a 2, then a 3, then a 3, then a 2, then a 2, then a 1, then a 5, then a 0.

#5

Hi, I would like to clarify where the third line in the following snippet from section “4.3 Normal distribution” comes from:

# Generate 10 random sequences of 10,000 uniformly distributed random variables
tmp = np.random.uniform(size=(10000,10))
x = 1.0 * (tmp > 0.3) + 1.0 * (tmp > 0.8)
mean = 1 * 0.5 + 2 * 0.2
variance = 1 * 0.5 + 4 * 0.2 - mean**2
print('mean {}, variance {}'.format(mean, variance)) 

In particular, does (tmp > 0.3) means take all values above 0.3 and where is this 0.3 and 0.8 coming from anyway?