\[X|P \sim Bernoulli(P)\]

… where \(X, P\) are random variables. Then:

\[\mathbb P(X = 1) = \int_0^1 \mathbb P(X = 1 | P = p) dF_P(p) = \int_0^1 p dF_P(p) = \mathbb E(P).\]

The distribution of \(X\) is only dependant on the expectation of \(P\).

Another way to see this:

\[\mathbb V (X) = \mathbb E_p (\mathbb V (X|p)) + \mathbb V_p (\mathbb E (X|p))\] \[= \mathbb E_p (p(1 - p)) + \mathbb V_p (p)\] \[= \mathbb E_p(p) - \mathbb E_p (p^2) + \mathbb E_p (p^2) - \mathbb E_p^2 (p)\] \[= \mathbb E_p(p) (1 - \mathbb E_p(p)).\]

So, random probabilities, random hazard rates or ‘random effects’ across groups which have just one observation are probably meaningless to talk about.



I used to do a fair bit of astrophotography in university - it’s harder to find good skies now living in the city. Here are some of my old pictures. I’ve kept making rookie mistakes (too much ISO, not much exposure time, using a slow lens, bad stacking, …), for that I apologize!

1 min read

Probabilistic PCA

I’ve been reading about PPCA, and this post summarizes my understanding of it. I took a lot of this from Pattern Recognition and Machine Learning by Bishop.

1 min read

Modelling with Spotify Data

The main objective of this post was just to write about my typical workflow and views rather than come up with a great model. The structure of this data is also outside my immediate domain so I thought it’d be fun to write up a small diary on making a model with it.

5 min read

Morphing with GPs

The main aim here was to morph space inside a square but such that the transformation preserves some kind of ordering of the points. I wanted to use it to generate some random graphs on a flat surface and introduce spatial deformation to make the graphs more interesting.

1 min read

SEIR Models

I had a go at a few SEIR models, this is a rough diary of the process.

3 min read

Speech Synthesis

The initial aim here was to model speech samples as realizations of a Gaussian process with some appropriate covariance function, by conditioning on the spectrogram. I fit a spectral mixture kernel to segments of audio data and concatenated the segments to obtain the full waveform. Partway into writing efficient sampling code (generating waveforms using the Gaussian process state space representation), I realized that it’s actually quite easy to obtain waveforms if you’ve already got a spectrogram.

4 min read

Efficient Gaussian Process Computation

I’ll try to give examples of efficient gaussian process computation here, like the vec trick (Kronecker product trick), efficient toeliptz and circulant matrix computations, RTS smoothing and Kalman filtering using state space representations, and so on.

4 min read
Back to Top ↑


Gaussian Process Middle C

First of my experiments on audio modeling using Gaussian processes. Here, I construct a GP that, when sampled, plays middle c the way a grand piano would.

~1 min read
Back to Top ↑


Back to Top ↑