Python, Monte Carlo, Monte Carlo Simulation, Importance Sampling, Machine Learning.
of x from the distribution p, plug those into f, and take their average. It turns out that as N gets large this thing approaches our answer. For the sake of brevity, let’s call this sum s. Let’s play with a one-dimensional example. Let’s say p(x) and f(x) are as below: In this case, things are