Book Image

Bayesian Analysis with Python

Book Image

Bayesian Analysis with Python

Overview of this book

The purpose of this book is to teach the main concepts of Bayesian data analysis. We will learn how to effectively use PyMC3, a Python library for probabilistic programming, to perform Bayesian parameter estimation, to check models and validate them. This book begins presenting the key concepts of the Bayesian framework and the main advantages of this approach from a practical point of view. Moving on, we will explore the power and flexibility of generalized linear models and how to adapt them to a wide array of problems, including regression and classification. We will also look into mixture models and clustering data, and we will finish with advanced topics like non-parametrics models and Gaussian processes. With the help of Python and PyMC3 you will learn to implement, check and expand Bayesian models to solve data analysis problems.
Table of Contents (15 chapters)
Bayesian Analysis with Python
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Exercises


  1. Rerun the first model using the variables petal length and then petal width. What are the main differences in the results? How wide or narrow is the 95% HPD interval in each case?

  2. Repeat exercise 1, this time using a Student's t-distribution as weakly informative prior. Try different value of .
  3. Go back to the first example, the logistic regression for classifying setosa or versicolor given sepal length. Try to solve the same problem using a simple linear regression model as we saw in the previous chapter. How useful is a linear regression compared to the logistic regression? Can the result be interpreted as a probability? Hint: check if the values of y are restricted to the [0, 1] interval.

  4. Suppose instead of a softmax regression we use a simple linear model by coding setosa =0, versicolor =1, and virginica = 2. Under the simple linear regression model, what will happen if we switch the coding? Will we get the same, or different, results?

  5. In the example for dealing with unbalanced...