Back to Browse

Sampling the univariate Normal by Box-Müller Transform | Example in Python

8.0K views
Jun 24, 2021
7:10

If you have a univariate Normal/Gaussian defined by its mean/mu and variance/standard deviation, how can you draw samples from it? Here are the notes: https://raw.githubusercontent.com/Ceyron/machine-learning-and-simulation/main/english/essential_pmf_pdf/univariate_normal_sampling.pdf Have you ever wondered how packages like SciPy or TensorFlow Probability create samples from a (univariate) Normal distribution? There are quite some ways to do so, but one common way that is also computationally very efficient (on high-performance vector computers) is called the Box-Müller Transform. It takes two uniformly distributed samples and generates two normally distributed ones from them. ------- 📝 : Check out the GitHub Repository of the channel, where I upload all the handwritten notes and source-code files (contributions are very welcome): https://github.com/Ceyron/machine-learning-and-simulation 📢 : Follow me on LinkedIn or Twitter for updates on the channel and other cool Machine Learning & Simulation stuff: https://www.linkedin.com/in/felix-koehler and https://twitter.com/felix_m_koehler 💸 : If you want to support my work on the channel, you can become a Patreon here: https://www.patreon.com/MLsim ------- Timestamps: 00:00 Introduction 00:33 Box-Müller Transform 02:10 Python: Standard Normal 04:19 Transform to arbitrary Normal 05:34 Python: Transformation 06:27 Summary 06:39 Outro

Download

1 formats

Video Formats

360pmp410.2 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

Sampling the univariate Normal by Box-Müller Transform | Example in Python | NatokHD