Monte Carlo Method, Random Number Generator, Importance Sampling, Reversetransformsampling, Rejection Sampling.
theta: p += x*x N.append(n) P.append(p/n) n = n*2 P_r = [2]*len(N) plt.plot(N,P) plt.plot(N,P_r,c='red') plt.legend(["Rejection Sampling value","true value(2)"]) plt.xlabel("number of samples (n) ") plt.show() Reference M.Yamasugi. Statistical Machine Learning-generative model-based pattern