当前位置:网站首页>Rejection sampling note
Rejection sampling note
2022-07-31 06:17:00 【Young_win】
section 1
The most critical part of reject sampling,make a rectangle、cast points into rectangles, etc.,All that is done is to obtain a uniform distribution of the area enclosed by the density curve.As long as it is possible to obtain such a sample that satisfies a uniform distribution under the density curve,We can then obtain a sampling of random variables that match this density curve.方法是,Just extract the abscissa of each blue dot,The sample formed by these abscissas is our target sample.

step1:Wrap this density curve with a rectangle,put density curve framed in a rectangle.
step2:Randomly cast points into the rectangle10000次(虚值).Random casting means within the rectangle,These points are uniformly distributed.
step3:Some points fall on the lower side of the density curve,Some points fall on the upper side of the density curve.Keep only the points on the underside of the density curve.
step4:Extract the abscissa of each blue point,The sample formed by these abscissas is our target sample.
section2
The above uses a rectangle,The rectangle is a proposed distribution that satisfies the uniform distribution,The proposed distribution is just an aid to obtain uniformly distributed samples under the curve of the target density function.Using a uniform distribution as the suggested distribution is sometimes inefficient,为什么这么说?It can be seen from the above example that,Evenly distributed many points(those green dots)都被剔除了,Caused a waste.Some other curves can be selected to frame the density curve,效率会提高一点.
这里The target density function curve is h ( x ) h(x) h(x),Corresponds to the blue line in the figure below;Suggestions for distribution density curves g ( x ) g(x) g(x),我们把 g ( x ) g(x) g(x)Multiply by a constant factor c c c,然后 用 c g ( x ) cg(x) cg(x)这条曲线 Frame the target density curve.
假定满足 g ( x ) g(x) g(x)Random variables of easily sampled,The steps to reject sampling are as follows:
- 从 g ( x ) g(x) g(x)Take a sample data,记 x ⋆ x^{\star} x⋆,take it as a suggestion
- Do you want to accept this suggestion? 作为满足 h ( x ) h(x) h(x)What about a sample data from the distribution??我们定义一个接受概率: α = h ( x ⋆ ) c g ( x ⋆ ) \displaystyle\alpha = \frac{h(x^{\star})}{c g(x^{\star})} α=cg(x⋆)h(x⋆)
也就是说,我们以 α \alpha α的概率 接受 x ⋆ x^{\star} x⋆ 作为 h ( x ) h(x) h(x)A sample of data distributed.
实际操作中,取一个 U ( 0 , 1 ) U(0, 1) U(0,1)的随机数 μ \mu μ,如果 μ < α \mu<\alpha μ<α,就接受 x ⋆ x^{\star} x⋆作为 h ( x ) h(x) h(x)a sample data of;否则,throw it away,回到1.步继续循环.Finally a sample can be obtained.
- The beginning of the article is to extract all at once10000个点,How did it become one by one??In fact, they correspond,The process of removing the blue dot Is equivalent to do whether refused to determine process.
- If there are uniformly distributed samples under the density curve,to get a sample of the distribution that matches the density curve.
- If the shape of the proposed distribution is closer to the target distribution,The more efficient the sampling is.
参考文献:https://gaolei786.github.io/statistics/reject.html
边栏推荐
- Gradle sync failed: Uninitialized object exists on backward branch 142
- IDEA控制台不能输入信息的解决方法
- Podspec automatic upgrade script
- Pytorch常用函数
- CAS:474922-22-0 Maleimide-PEG-DSPE 磷脂-聚乙二醇-马来酰亚胺简述
- Web Screenshots and Reverse Proxy
- Cholesterol-PEG-DBCO Cholesterol-Polyethylene Glycol-Diphenylcyclooctyne Chemical Reagent
- cocos2d-x-3.2 create project method
- 【解决问题】RuntimeError: The size of tensor a (80) must match the size of tensor b (56) at non-singleton
- MYSQL事务与锁问题处理
猜你喜欢
随机推荐
Pytorch每日一练——预测泰坦尼克号船上的生存乘客
Shell/Vim相关list
This in js points to the prototype object
自然语言处理相关list
变分自编码器VAE实现MNIST数据集生成by Pytorch
DC-CDN学习笔记
cocos2d-x-3.2 image graying effect
Markdown help documentation
pytorch模型微调finetuning训练image_dog(kaggle)
Sqlite column A data is copied to column B
Embedding cutting-edge understanding
2021年软件测试面试题大全
After unicloud is released, the applet prompts that the connection to the local debugging service failed. Please check whether the client and the host are under the same local area network.
Global scope and function scope in js
SSH automatic reconnection script
禅道安装及使用教程
用pytorch里的children方法自定义网络
Pytorch实现ResNet
Cholesterol-PEG-Amine CLS-PEG-NH2 Cholesterol-Polyethylene Glycol-Amino Research Use
Embedding前沿了解









