Chapter 4
Chapter 4
Michal Oleszak
Machine Learning Engineer
Bayesian data analysis in production
Grid approximation: inconvenient with many parameters
Michal Oleszak
Machine Learning Engineer
Running the model revisited
formula = "num_clicks ~ clothes_banners_shown + sneakers_banners_shown"
Number of parameters: 4
waic_scale
trace_2 log
trace_1 log
Michal Oleszak
Machine Learning Engineer
Number-of-clicks model again
formula = "num_clicks ~ clothes_banners_shown + sneakers_banners_shown + weekend"
(4000, 5)
print(posterior_predictive["y"])
pm.plot_posterior(posterior_predictive["y"][:, 0])
error_distribution = np.array(errors).reshape(-1)
error_distribution.shape
(20000,)
pm.plot_posterior(error_distribution)
Michal Oleszak
Machine Learning Engineer
The Avocado, Inc.
pm.GLM.from_formula(formula, data=bikes)
trace = pm.sample(draws=1000, tune=500)
pm.Model() pm.forestplot()
pm.GLM.from_formula() pm.traceplot()
pm.sample()
pm.Normal()
pm.fast_sample_posterior_predictive() pm.hpd()
Michal Oleszak
Machine Learning Engineer
What you know
Chapter 1: The Bayesian Way Chapter 3: Bayesian Inference
β2 = β20 + β21 x3
Think Bayes by Allen Downey
More regression (logistic, Poisson, ...)
h p://allendowney.github.io/ThinkBayes2
Bayesian machine learning