Q1
Q2.
Calculate:
$ P(d^0, i^1, g^3, s^1, l^1) $
$ P(d^0, i^1,l^1) $
$ P(G | i^0, d^0) $
$ P(G | i^0) $
Q3 Calculate P(Accident = 1|President = 1) and P(Accident = 1| Traffic=1, President = 1)

Suppose $ X $ is a random variable with two values 0 and 1, $ F $ is another random variable such that
$$ P(X = 1 | F = f) = f $$
Then,
$$ P(X = 1) = E(F) $$
Now in order to learn the parameter, you let's model $ F $ along with the our variable $ X $. This is called as the Augmented Bayesian Network representation of our earlier Bayesian Net.
Let's $ F $ follow the density function $ \rho $ which is called the prior density function of the parameters.
Now by the Bayes' rule we have $$ P(F=f\;|\;D=d) = \frac{P(D=d \;|\; F=f) \rho (f)} {P(D=d)} $$ In this way, we'll learn the distribution of $ F $ from the data.

Suppose
We have a set of random variables (or random vectors) $ D = { X^{(1)} , X^{(2)} , . . . X^{(M)} } $ such that each $ X^{(h)} $ has the same space.
There is a random variable $ F $ with density function $ \rho $ such that the $X^{(h)}$ s are I.I.D. for all values $ f $ of $ F $.
Then $ D $ is called a sample of size $ M $ with parameter $ F $.
Given a sample, the density function $ \rho $ is called the prior density function of the parameters relative to the sample. It represents our prior belief concerning the unknown parameters.
Given a sample, the marginal distribution of each $ X^{(h)} $ is the same. This distribution is called the prior distribution relative to the sample. It represents our prior belief concerning each trial.
Suppose we have a sample of size $ M $ such that
Then $D$ is called a binomial sample of size $M$ with parameter $F$.

Suppose
Then $ P(d) = E(F^s (1 − F)^t) $.
Proof : Marginalization: $$ P(D = d) = \int_0^1 P(D=d \;|\; F = f) \rho(F = f) df $$
If the conditions in Theorem 6.2 hold, and $F$ has a beta distribution with parameters $ a, b, N = a + b$, then,
$$ P(d) = \frac{\Gamma (N)}{\Gamma(N + M)} \frac{\Gamma(a + s) \Gamma (b + t)}{\Gamma(a) \Gamma(b)} $$
Proof: Application of Lemma 6.4
Suppose $F$ has a beta distribution with parameters $a, b$ and $ N = a + b$. $s$ and $t$ are two integers ≥ 0, and $M = s + t$. Then
$$ E[F^s \; [1 − F]^t] = \frac{\Gamma (N)}{\Gamma(N + M)} \frac{\Gamma(a + s) \Gamma (b + t)}{\Gamma(a) \Gamma(b)} $$
Suppose $F$ has a beta distribution with parameters $a, b$ and $ N = a + b$. $s$ and $t$ are two integers ≥ 0, and $M = s + t$. Then
$$\frac{f^s (1 − f)^t \rho(f)}{E(F^s [1 − F]^t )} = Beta(f ; a + s, b + t) $$
If the conditions in Theorem 6.2 hold, then $$ ρ(f|d) = \frac{f^s (1 − f )^t ρ(f)}{E(F^s[1 − F ]^t)} $$
where $\rho(f|d) $ denotes the density function of $F$ conditional on $D = d$.
Suppose the conditions in Theorem 6.2 hold, and F has a $ Beta $ distribution with parameters $a, b$ and $ N = a + b$. That is, $$ ρ(f) = Beta(f ; a, b) $$
Then, $$ ρ(f |d) = beta(f ; a + s, b + t) $$
Suppose the conditions in Theorem 6.2 hold, and we create a binomial sample of size $M + 1$ by adding another variable $X^{(M+1)} $ . Then if $ D $ is the binomial sample of size $ M $, the updated distribution relative to the sample and data $ d $ is given by
$$P(X^{(M +1)} = 1| d) = E(F |d) $$
If the conditions in Theorem 6.4 hold and F has a beta distribution with parameters $a, b$ and N = a + b, then
$$ P(X^{(M +1)} = 1| d) = \frac{a + s}{N + M} = \frac{a + s} {a + s + b + t} $$