The below code is in line with the part I of the tutorial. It seems to produce more correct guesses:
num_samples = 1000
predictive = Predictive(model, guide=guide, num_samples=num_samples)
samples_svi = predictive(is_cont_africa, ruggedness, None)
svi_samples = {k: v.reshape(num_samples).detach().cpu().numpy()
for k, v in samples_svi.items()
if k not in ["obs"]}
with this call, the results are similar with the part I.
Hum, this is intimidating. Never took part in any Open Source project so far.
I do not even now what PR stands for. It is never too late to learn, however.
It is long overdue and, now is the time to jump in, I guess.
Let me take that plunge. Get a little thrill down the spine from it I must say.
@eb8680_2: thanks. I shall check your pointers. They might overlap with the ones I found myself. @fritzo: It looks I have created my first PR and I hope it is correct. Clearly, it should be double checked.
One more thing. While working through the tutorial, I used the Predictive for the MCMC case and display the same results as in Bayesian Regression I. I could easily extend the tutorial if you think it is useful.