Publications by Posts | Joshua Cook

Mixing centered and non-centered parameterizations in a hierarchical model with PyMC3

10.07.2021

Background In his post on hierarchical models, Michael Betancourt goes in-depth on the funnel pathologies that often plague hierarchical modeling. My goal here is to reproduce his analysis in PyMC3 and explore these problems and their solutions. A hierarchical model is one that simultaneously models data from individual distributions and a popula...

13590 sym Python (18882 sym/65 pcs) 68 img 1 tbl

Notes on ‘Deep Work’

18.09.2021

I have finally read the book Deep Work where he describes the reasons and methods for focussing on maximizing “deep” work over “shallow” work. From the popularity of this book and my own experience with some of the strategies explained in the book, I believe it is worthwhile to experiment with Newport’s proposed system. To this end, I h...

18368 sym

Setting up Appwrite on DigitalOcean

16.10.2021

Here, I lay out step-by-step instructions for getting a Appwrite backend up and running on DigitalOcean. First, however, I briefly describe what Appwrite and DigitalOcean are and why one would want to use either of these services. For those who are just looking for a quick how-to, you can jump straight to the listed instructions. If you notice a...

5480 sym R (106 sym/4 pcs) 18 img

Type hinting a list subclass in Python with function overloading

13.11.2021

Below, I describe how to type hint some of the dunder methods of a subclass of the built-in Python list. I begin by describing why I wanted to do this in the first place, then, with the aim of being somewhat pedagogical, how I figured out what to do before getting to the solution. As I do not go through all of the dunder methods of list, I hope t...

6381 sym Python (2795 sym/5 pcs) 6 img

SwiftBar plugin for storing text snippets

16.01.2022

Introduction I found that I was constantly referring to the IPython documentation to look up the code for the autoreload magic command and wished there was an easy place for me to keep and access these sort of “oft-copied” texts. I realized I could just build a simple SwiftBar application and put these snippets in my menu bar. SwiftBar Swif...

3939 sym R (1892 sym/7 pcs) 2 img

Non-linear model of serial dilutions with Stan

22.01.2022

In chapter 17 “Parametric nonlinear models” of Bayesian Data Analysis1 by Gelman et al., the authors present an example of fitting a curve to a serial dilution standard curve and using it to estimate unknown concentrations. Below, I build the model with Stan and fit it using MCMC. Unfortunately, I was unable to find the original data in Gelma...

5011 sym R (8894 sym/11 pcs) 10 img 1 tbl

PyMC3 MCMC performance with and without Theano’s NumPy BLAS warning

11.02.2022

Introduction PyMC3 is a Python-based probabilistic programming language used to fit Bayesian models with a variety of cutting-edge algorithms including NUTS MCMC1 and ADVI2. It is not uncommon for PyMC3 users to receive the following warning: WARNING (theano.tensor.blas): Using NumPy C-API based implementation for BLAS functions. where Theano3 ...

5245 sym R (89 sym/1 pcs) 8 img 1 tbl

Experimenting with multi-level and hierarchical splines in PyMC

27.02.2022

Table of Contents Introduction Setup One group Two groups: single set of weights Two groups: separate spline bases and per-group weights Two groups: single spline basis and per-group weights Two groups: per-group weights with hierarchical prior One group: multivariate-normal prior on weights Two group: multivariate normal prior on weight...

22709 sym Python (36960 sym/118 pcs) 140 img 5 tbl