TFP

Introducing Stan2tfp - a lightweight interface for the Stan-to-TensorFlow Probability compiler

TL;DR The new Stan compiler has an alternative backend that allows you to do this: stan2tfp is a lightwight interface for this compiler, that allows you to do this with one line of code, and fit the model to data with another. Why stan2tfp In short - to get the convenience of Stan programs and the scalability of TensorFlow. The model is written in Stan, which means you get a lot of the benefits of having the Stan compiler behind your shoulder (types, bounds, etc).

Mr. P meets TFP - mixed effects model with post-stratification in TensorFlow Probability

TL;DR We’ll: Learn an interesting method for generalizing inferences from a biased sample to a population of interest See why prior predictive checks are great Implement a simple mixed-effects model in TFP Intro This post is a TFP port of Lauren Kennedy and Jonah Gabry’s excellent MRP with rstanarm vignette. It describes a very interesting statistical method for generalizing inferences from a biased sample to a population of interest.

Bayesian golf puttings, NUTS, and optimizing your sampling function with TensorFlow Probability

TL;DR We’ll: Port a great Bayesian modelling tutorial from Stan to TFP Discuss how to speed up our sampling function Use the trace_fn to produce Stan-like generated quantities Explore the results using the ArviZ library. Intro This is a TFP-port one of of the best Bayesian modelling tutorials I’ve seen online - the Model building and expansion for golf putting Stan tutorial. It’s a beautiful example of modeling from first principles, and why the incorporation of domain knowledge into a statistical model - in this case, knowing a little bit about golf and some high-school physics - is so important.

Survival analysis, censoring and hacking the log_prob in TensorFlow Probability

TL;DR Survival analysis is a super useful technique for modelling time-to-event data; implementing a simple survival analysis using TFP requires hacking around the sampler log probability function; in this post we’ll see how to do this, and introduce the basic terminology of survival analysis. Survival analysis 101 Survival analysis is an incredibly useful technique for modeling time-to-something data. “something” can be the death a patient (hence the name), the failure of some part in a machine, the churn of a customer, the fall of a regime, and tons of other problems.

Varying Slopes Models and the CholeskyLKJ distribution in TensorFlow Probability

TL;DR Covariance matrices allow us to capture parameter correlations in multivariate hierarchical models; sampling these using Hamiltonian Monte Carlo in Tensorflow Probability can be tricky and confusing; this post is about some of the math involved and how to get this right. Intro Hierarchical models allow us to account for variations between different groups in our data. Let’s say that, for some reason, we have different groups of tadpoles in different tanks and we want to model per-tank survival rates.

A Tutorial on Varying Intercepts Models with TensorFlow Probability

Intro This post is about building varying intercepts models using TensorFlow Probability (“TFP”). It’s basically my attempt to translate Sigrid Keydana’s wonderful blog post from R to Python. I’m doing this for a couple of reasons: First, I’ve played with TFP before, was quite impressed by its performance and flexibility, and wanted to learn more about it; Second, I wanted to start blogging, and this seemed like an easy start; Last, TFP is rather new, and there aren’t a whole lot of resources and tutorials about it - so this might even prove useful to someone, someday.