如何实现非均匀概率分布? [英] how to implement non uniform probability distribution?

查看:501
本文介绍了如何实现非均匀概率分布?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在遗传算法中实现非均匀概率分布.

I am trying to implement non-uniform probability distribution in genetic algorithm.

在实施遗传程序时,我有一个实验,该实验有3个结果,每个结果都有不同的概率.假设一个结果的概率是0.85,另一个结果的概率是0.01,最后一个结果的概率是0.14?

In the implementation of genetic program, I have an experiment which has 3 outcomes, where each outcome has different probabilities. Let say, probablity of one outcome is 0.85, other is 0.01 and last one is 0.14?

P.S:我最近才知道这被称为概率的非均匀分布.我正在用Java实现它,任何人都可以说出非均匀概率背后的理论.分布与还有实现它的所有Java软件包.

P.S: i recently came to know that it is called non-uniform distribution of probability. I'm implementing it in Java, can anyone tell the theory behind non-uniform prob. distribution & also any Java packages implementing it.

随时问我是否需要有关此问题的更多信息!

Feel free to ask me know, if u need any more information on the problem!

提前谢谢!

推荐答案

对于简单的离散分布,您可以编写一个采样器,该采样器将通过使用累积概率以期望的频率返回结果.

For a simple discrete distribution, you can write a sampler that will return your outcomes with the desired frequency by using the cumulative probabilities.

Random r = new Random();
double v = r.nextDouble();

if (v <= 0.85) { return 0; }
if (v <= 0.86) { return 1; }
return 2;

这将返回数字0、1和2,概率分别为0.85、0.01和0.14.

This will return the numbers 0, 1 and 2 with a probability of 0.85, 0.01 and 0.14.

关于非均匀概率分布的理论,您可以从概率分布的Wikipedia文章开始. ;请特别注意页面底部的可折叠部分.您会发现有数十种具有不同属性的非均匀分布(连续分布和离散分布).

As far as the theory on non-uniform probability distributions, you can start with this Wikipedia article on probability distributions; take special note of the collapsible sections at the bottom of the page. You will find that there are dozens of non-uniform distribution (both continuous and discrete) with different properties.

这篇关于如何实现非均匀概率分布?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆