How I can find the step of this equation based on Bayes' theorem

30 Views Asked by At

Can anyone show me step by step, how to derive this equation, and the formulas used? Maybe the author uses Bayes' Theorem but I cannot find how...

$P(z_k | d_i,w_j) = \frac{P(w_j,z_k|d_i)}{P(w_j|d_i)} = \frac{P(w_j|z_k,d_i)P(z_k|d_i)}{\sum_{i=1}^M P(w_j|z_i,d_i)P(z_i|d_i)}$

1

There are 1 best solutions below

3
On

The first equality uses $$ P(A, B \mid C) = P(A \mid B, C) \cdot P(B \mid C) \tag{$\spadesuit$} $$ More specifically, $$ P(z_k, w_j \mid d_i) = P(z_k \mid w_j, d_i) \cdot P(w_j \mid d_i) \implies P(z_k \mid w_j, d_i) = \frac{P(z_k, w_j \mid d_i)}{P(w_j \mid d_i)} $$ For the second equality, by $(\spadesuit)$, we have first $$ P(w_j, z_k \mid d_i) = P(w_j \mid z_k, d_i) \cdot P(z_k \mid d_i) $$ and by law of total probability, $$ P(w_j \mid d_i) = \sum_{k = 1}^M P(w_j, z_k \mid d_i) = \sum_{k=1}^M P(w_j \mid z_k, d_i) \cdot P(z_k \mid d_i) $$