Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

genetic algorithm - how to implement non uniform probability distribution?

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

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: 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!

Thanks in advance!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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;

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

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...