org.encog.mathutil.randomize
Class RandomChoice
- java.lang.Object
-
- org.encog.mathutil.randomize.RandomChoice
-
- All Implemented Interfaces:
- java.io.Serializable
public class RandomChoice extends java.lang.Object implements java.io.SerializableGenerate random choices unevenly. This class is used to select random choices from a list, with a probability weight places on each item in the list. This is often called a Roulette Wheel in Machine Learning texts. How it differs from a Roulette Wheel that you might find in Las Vegas or Monte Carlo is that the areas that can be selected are not of uniform size. However, you can be sure that one will be picked. http://en.wikipedia.org/wiki/Fitness_proportionate_selection- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description RandomChoice(double[] theProbabilities)Construct a list of probabilities.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description intgenerate(java.util.Random theGenerator)Generate a random choice, based on the probabilities provided to the constructor.intgenerate(java.util.Random theGenerator, int skip)Generate a random choice, but skip one of the choices.
-
-
-
Constructor Detail
-
RandomChoice
public RandomChoice(double[] theProbabilities)
Construct a list of probabilities.- Parameters:
theProbabilities- The probability of each item in the list.
-
-
Method Detail
-
generate
public int generate(java.util.Random theGenerator)
Generate a random choice, based on the probabilities provided to the constructor.- Parameters:
theGenerator- The random number generator.- Returns:
- The random choice.
-
generate
public int generate(java.util.Random theGenerator, int skip)Generate a random choice, but skip one of the choices.- Parameters:
theGenerator- The random number generator.skip- The choice to skip.- Returns:
- The random choice.
-
-
DMelt 3.0 © DataMelt by jWork.ORG