Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Bayesian Analysis with Python

You're reading from   Bayesian Analysis with Python Introduction to statistical modeling and probabilistic programming using PyMC3 and ArviZ

Arrow left icon
Product type Paperback
Published in Dec 2018
Publisher Packt
ISBN-13 9781789341652
Length 356 pages
Edition 2nd Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Osvaldo Martin Osvaldo Martin
Author Profile Icon Osvaldo Martin
Osvaldo Martin
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Preface 1. Thinking Probabilistically FREE CHAPTER 2. Programming Probabilistically 3. Modeling with Linear Regression 4. Generalizing Linear Models 5. Model Comparison 6. Mixture Models 7. Gaussian Processes 8. Inference Engines 9. Where To Go Next?
10. Other Books You May Enjoy

To get the most out of this book

The code in the book was written using Python version 3.6. To install Python and Python libraries, I recommend using Anaconda, a scientific computing distribution. You can read more about Anaconda and download it at https://www.anaconda.com/download/. This will install many useful Python packages on you system. You will need to install two more packages. To install PyMC3 please use conda:

conda install -c conda-forge pymc3

And for ArviZ you can do it with the following command:

pip install arviz

An alternative way to install the necessary packages, once Anaconda is installed in your system, is to go to https://github.com/aloctavodia/BAP and download the environment file named bap.yml. Using it, you can install all the necessary packages by doing the following:

conda env create -f bap.yml

The Python packages used to write this book are listed here:

  • IPython 7.0
  • Jupyter 1.0 (or Jupyter-lab 0.35)
  • NumPy 1.14.2
  • SciPy 1.1
  • pandas 0.23.4
  • Matplotlib 3.0.2
  • Seaborn 0.9.0
  • ArviZ 0.3.1
  • PyMC3 3.6

The code presented in each chapter assumes that you have imported at least some of these packages. Instead of copying and pasting the code from the book, I recommend downloading the code from https://github.com/aloctavodia/BAP and running it using Jupyter Notebook (or Jupyter Lab). I will keep this repository updated for new releases of PyMC3 or ArviZ. If you find a technical problem running the code in this book, a typo in the text, or any other mistake, please fill an issue in that repository and I will try to solve it as soon as possible.

Most figures in this book are generated using code. A common pattern you will find in this book is the following: a block of code immediately followed by a figure (generated from that code). I hope this pattern will look familiar to those of you using Jupyter Notebook/Lab, and I hope it does not appear annoying or confusing to anyone.

Download the example code files

You can download the example code files for this book from your account at www.packt.com. If you purchased this book elsewhere, you can visit www.packt.com/support and register to have the files emailed directly to you.

You can download the code files by following these steps:

  1. Log in or register at www.packt.com.
  2. Select the SUPPORT tab.
  3. Click on Code Downloads & Errata.
  4. Enter the name of the book in the Search box and follow the onscreen instructions.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR/7-Zip for Windows
  • Zipeg/iZip/UnRarX for Mac
  • 7-Zip/PeaZip for Linux

The code and figures for the book are hosted on GitHub at https://github.com/PacktPublishing/Bayesian-Analysis-with-Python-Second-Edition. In case there's an update to the code, it will be updated on the existing GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Download the color images

Conventions used

There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in text, filenames, or name of functions. Here is an example: "Most of the preceding code is for plotting; the probabilistic part is performed by the y = stats.norm(mu, sd).pdf(x) line."

A block of code is set as follows:

μ = 0.
σ = 1.
X = stats.norm(μ, σ)
x = X.rvs(3)

Bold: Indicates a new term, an important word, or words that you see onscreen.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at AU $24.99/month. Cancel anytime