$25
Exercise 1
1. Write the factorization of the joint distribution π(π΄, π΅, πΆ, π·, πΈ, πΉ) corresponding to the Bayesian network:
2. Indicate whether the following statements on conditional indepence are True or False and motivate your answer. a. A ⊥⊥ B
b. A ⊥⊥ F
c. A ⊥⊥ C | {B,E}
d. F ⊥⊥ D | B
e. B ⊥⊥ D | C
Exercise 2
Topic models are statistical models that learn the distribution of the abstract topics occurring in a collection of documents. In this context, documents are collections of topics and topics are collections of words.
We consider a dictionary of π words, an ordered collection of π· documents and an ordered collection of π possible topics appearing in each document. We build our model using the indexes representing each quantity in its collection (e.g. π is the π-th word in the dictionary). For simplicity, we assume that all documents contain the same number of words. Each document can contain multiple topics; specifically, we associate a topic to each word appearing in the document.
We make the following assumptions:
π· is the total number of documents
π is the total number of topics
π < π is the number of words per document
For the π-th word and the π-th document, we sample a topic π‘π,π from a Categorical distribution on ππ
The distribution ππ of topics in the π-th document is a Dirichlet distribution with concentration parameters πΌ (the length of πΌ is π)
The π-th word in the π-th document, namely π€π,π, is sampled from a Categorical distribution on ππ‘π,π
The distribution ππ of words per topic π is a Dirichlet distribution with concentration parameters π½ (the length of π½ is π)
1. Write the generative process of the following graphical model. Be aware of plate notation!
2. Set π = 5, π· = 10, π = 50, π = 100 and use pyro to implement this graphical model as a function of the hyperparameters model(alpha, beta) , that outputs theta, phi, t, w . 3. Evaluate your function on the hyperparameters
alpha = torch.tensor([0.5, 0.3, 0.1, 0.4, 0.2])
beta = dist.Gamma(1./T, 1.).sample((W,)) and print the shape of the output tensors theta, phi, t, w .