Importance Sampling 예제

291 μs

F=abf(x)dxη=f(ξ)p(ξ),abp(ξ)dξ=1여기서 p 는 probability density function(PDF)E[η]=E[f(ξ)p(ξ)]=abf(x)p(x)p(x)dx=abf(x)dx=IE[η]=F=E[f(ξ)p(ξ)]1Ni=0N1f(x)p(x)F=abf(x)dxFN=1Ni=0N1f(Xi)p(Xi),XipXi는 p 분포에서 샘플링한 값

5.4 μs
61.6 ms
p(x)=2π 인 경우 즉 Uniform distribution

f(x)=sin(x)p(x)=2πCDF(x)=2πxri=01=CDF(xi)=2πxixi=0π2=π2riFN=1Ni=0N1sin(xi)p(xi)

9.8 μs
p(x)=8xπ2 인 경우 즉 f(x) 와 유사한 분포를 선택

f(x)=sin(x)p(x)=8π2xCDF(x)=4x2π2ri=01=CDF(xi)=4xi2π2xi=0π2=π2riFN=1Ni=0N1sin(xi)p(xi)

7.0 μs
348 ms
f (generic function with 1 method)
22.4 μs
p₁ (generic function with 1 method)
22.6 μs
p₂ (generic function with 1 method)
30.7 μs
N
16
100 ns
epoch
100
100 ns
mean (generic function with 92 methods)
17.6 μs
303 ms
106 ms
500 ns
800 ns
9.6 μs
"Mean squre error of (arrF₁, arrF₂) : (0.08928651574771553, 0.006557529878748583)"
5.6 μs