What is PyMC3?

What is PyMC3?

Often we hear the statement on weather channels “30% chance of snowfall tomorrow”, looking deeper into the statement confusion can normally arise as to what this actually may mean. It is somewhat difficult to attach a meaning to such statements and that too from a perspective of a frequentist.

We turn to Bayesian statistics in order to come up with a solution for such statements. In essence the Bayesian approach tells us that we can never be fully sure about our beliefs but we definitely can say how confident we are about related events

A drawback we encounter from utilising the Bayesian approach is that it is computationally difficult to work with, there is a lot of tedious mathematical computations accompanied with performing Bayesian inference which are quite hindering in time when wanting quick overview of data.

Fortunately for us to address some of these issues, PyMC3 is a package available in the Python programming language for statistical modelling, in particular Bayesian statistical modelling and also probabilistic machine learning. The PyMC3 framework allows you to feature Markov Chain Monte Carlo (MCMC) algorithms.

These very algorithms are high-performance tools for sampling and segmentation. This combination of methods of Markov Chain and Monte Carlo allows random sampling of high dimensional probability distributions that also gives importance to the consideration of probabilistic dependence between samples by constructing a Markov Chain that comprise the Monte Carlo sample. These algorithms help you without the need for extensive knowledge and specialization in complicated algorithms.

the power of Bayesian analysis in which we have a full distribution from sampling from each parameter.

Here we've generated 10 points based on true slope, true intercept and true sigma our Data Scientist, Ossama picked himself.

a linear model is fitted to the data points without thinking in a probabilistic framework

Above, the formula shows how a linear model is fitted to the data points without thinking in a probabilistic framework, the three estimated values are somewhat close to the true values. In the picture with the three plots we see the power of Bayesian analysis in which we have a full distribution from sampling from each parameter. This distribution gives us a better idea about how confident we should be about the posterior mean.

The advantages seen in utilising PyMC3 in my journey were in the ease enabled by this package in fitting regression models, checking if a model had converged for sanity, making a selection between competing models and generating predictions for new data.

Overall PyMC3 really shines when doing any probabilistic framework based programming for Bayesian inference and analysis, coupled with the fact it’s in Python makes it a fitting choice for a tool to be in the belt of a data scientist.?

Glyn Heath

Tech Entrepreneur | Founder | Investor | Advisor

3 年

A really clear explanation of how PyMC3 can be used to great advantage in certain use cases. Good work Ossama Shafiq !

Ed Dixon

We are hiring! Artificial Intelligence | Data Science | Machine Learning

3 年

Interesting piece Ossama Shafiq. These plots are great ??

?? Kay H.

Connecting brands to creators & cultural storytelling ??

3 年

Great article Ossama Shafiq!

要查看或添加评论,请登录

Bayezian的更多文章