Python, Monte Carlo, Monte Carlo Simulation, Importance Sampling, Machine Learning.
curve of f(x) looks like: Now let’s define the distribution of p(x) and q(x) : def distribution(mu=0, sigma=1): # return probability given a value distribution = stats.norm(mu, sigma) return distribution # pre-setting n = 1000 mu_target = 3.5 sigma_target = 1 mu_appro = 3 sigma_appro = 1 p_x =