Drawing From a Random Distribution in SQL

<p>There are different methods for updating a reinforcement learning agent&rsquo;s policy at each iteration. A few weeks ago we started experimenting with replacing our current method with a Bayesian inference step. Some of the data workloads within our agent are written in SQL that is executed on GCP&rsquo;s BigQuery engine. We use this stack because it provides scalable computational capabilities, ML packages and a straightforward SQL interface.</p> <p>The Bayesian inference step we looked to implement uses one of the&nbsp;<a href="https://en.wikipedia.org/wiki/Beta_distribution#Mean_and_sample_size" rel="noopener ugc nofollow" target="_blank">alternative parametrizations of a beta distribution</a>. Which means that we will need to be able to draw from a beta distribution in SQL. While working on this, I discovered that drawing from the random distribution in SQL is a topic with very few well documented examples. So I&rsquo;m writing about it here..</p> <p><a href="https://towardsdatascience.com/drawing-from-a-random-distribution-in-sql-b6c97c89e45c"><strong>Read More</strong></a></p>