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).
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.
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.