Probabilistic Machine Learning Homework 02 solution

$24.99

Original Work ?

Download Details:

  • Name: Homework_2-vgdi7e.zip
  • Type: zip
  • Size: 315.46 KB

Category: You will Instantly receive a download link upon Payment||Click Original Work Button for Custom work

Description

5/5 - (2 votes)

Exercise 1
Use the following lemma to generate samples from a distribution in pyro. Plot the resulting distribution
using sns.distplot function.
Lemma Let be independent random variables, then is a random variable with
distribution.
500 π΅π‘–π‘›π‘œπ‘šπ‘–π‘Žπ‘™(30, 0.5)
𝑋1, … , 𝑋𝑛 π΅π‘’π‘Ÿπ‘›π‘œπ‘’π‘™π‘™π‘–(𝑝) 𝑋 = 𝑋1 + … + 𝑋𝑛
π΅π‘–π‘›π‘œπ‘šπ‘–π‘Žπ‘™(𝑛, 𝑝)
Exercise 2
1. (theory) Consider the Gamma distribution with p.d.f.
and the Poisson distribution with p.m.f.
Given the generative model
prove that the Gamma distribution is a conjugate prior for the Poisson likelihood.
2. (code) Set the parameters of the Gamma distribution to and . Write the pyro code to sample and , extract
samples from the distributions of both random variables and plot their histograms.
3. (code) Suppose you observe some data . Plot samples from the posterior distribution of as the
number of observed data points from increases:
Section “Probability distributions” in notebook 01.
Section “Conjugate priors” in notebook 02.
1 Gamma(𝛼, 𝛽)
𝛽𝛼
Ξ“(𝛼)
π‘₯π›Όβˆ’1π‘’βˆ’π›½π‘₯
Poisson(πœ†)
. πœ†π‘˜π‘’βˆ’πœ†
π‘˜!
πœ†
π‘₯
∼ Gamma(𝛼, 𝛽)
∼ Poisson(πœ†)
2
𝛼 = 1 𝛽 = 2 πœ† π‘₯ 300
π‘₯ = [3, 10, 2, 5, 6, 7] 300 πœ†
π‘₯
π‘₯
π‘₯
π‘₯
= [3, 10]
= [3, 10, 2, 5]
= [3, 10, 2, 5, 6, 7].
1
2