本文整理汇总了Java中org.apache.commons.math3.random.Well44497b类的典型用法代码示例。如果您正苦于以下问题:Java Well44497b类的具体用法?Java Well44497b怎么用?Java Well44497b使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Well44497b类属于org.apache.commons.math3.random包,在下文中一共展示了Well44497b类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: computeEnrichment
import org.apache.commons.math3.random.Well44497b; //导入依赖的package包/类
static void computeEnrichment(NetworkProvider networkProvider,
AnnotationProvider annotationProvider,
BackgroundMethod backgroundMethod,
int quantitativeIterations,
int randomSeed,
ProgressReporter progressReporter,
DefaultEnrichmentLandscape landscape) {
if (annotationProvider.isBinary()) {
computeBinaryEnrichment(networkProvider, annotationProvider, progressReporter, landscape.neighborhoods,
backgroundMethod);
} else {
RandomGenerator generator = new Well44497b(randomSeed);
int totalNodes = networkProvider.getNodeCount();
NeighborhoodScoringMethod scoringMethod = new RandomizedMemberScoringMethod(annotationProvider, generator,
quantitativeIterations,
totalNodes);
computeQuantitativeEnrichment(networkProvider, annotationProvider, scoringMethod, progressReporter,
landscape.neighborhoods);
}
}
示例2: RandomCirclePointGenerator
import org.apache.commons.math3.random.Well44497b; //导入依赖的package包/类
/**
* @param x Abscissa of the circle center.
* @param y Ordinate of the circle center.
* @param radius Radius of the circle.
* @param xSigma Error on the x-coordinate of the circumference points.
* @param ySigma Error on the y-coordinate of the circumference points.
* @param seed RNG seed.
*/
public RandomCirclePointGenerator(double x,
double y,
double radius,
double xSigma,
double ySigma,
long seed) {
final RandomGenerator rng = new Well44497b(seed);
this.radius = radius;
cX = new NormalDistribution(rng, x, xSigma,
NormalDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
cY = new NormalDistribution(rng, y, ySigma,
NormalDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
tP = new UniformRealDistribution(rng, 0, MathUtils.TWO_PI,
UniformRealDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
}
示例3: TravellingSalesmanSolver
import org.apache.commons.math3.random.Well44497b; //导入依赖的package包/类
/**
* @param cityList List of cities to visit in a single travel.
* @param numNeuronsPerCity Number of neurons per city.
* @param seed Seed for the RNG that is used to present the samples
* to the trainer.
*/
public TravellingSalesmanSolver(City[] cityList,
double numNeuronsPerCity,
long seed) {
random = new Well44497b(seed);
// Make sure that each city will appear only once in the list.
for (City city : cityList) {
cities.add(city);
}
// Total number of neurons.
numberOfNeurons = (int) numNeuronsPerCity * cities.size();
// Create a network with circle topology.
net = new NeuronString(numberOfNeurons, true, makeInitializers()).getNetwork();
}
示例4: getNormalVector
import org.apache.commons.math3.random.Well44497b; //导入依赖的package包/类
/**
* @return Vector of iid normally distributed random variables
*/
public static double [] getNormalVector(int D) {
RandomGenerator rng = new Well44497b(Prng.nextLong());
double [] ret = new double[D];
NormalDistribution N = new NormalDistribution(rng, 0, 1, 1e-6);
for(int i=0; i<D; i++) {
ret[i] = N.sample();
}
return ret;
}
示例5: simulateFromPoissonGammaGaussian
import org.apache.commons.math3.random.Well44497b; //导入依赖的package包/类
/**
* Randomly generate a histogram from poisson-gamma-gaussian samples
*
* @return The histogram
*/
private int[] simulateFromPoissonGammaGaussian()
{
// Randomly sample
RandomGenerator random = new Well44497b(System.currentTimeMillis() + System.identityHashCode(this));
PoissonDistribution poisson = new PoissonDistribution(random, _photons, PoissonDistribution.DEFAULT_EPSILON,
PoissonDistribution.DEFAULT_MAX_ITERATIONS);
CustomGammaDistribution gamma = new CustomGammaDistribution(random, _photons, _gain,
GammaDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
final int steps = simulationSize;
int[] sample = new int[steps];
for (int n = 0; n < steps; n++)
{
if (n % 64 == 0)
IJ.showProgress(n, steps);
// Poisson
double d = poisson.sample();
// Gamma
if (d > 0)
{
gamma.setShapeUnsafe(d);
d = gamma.sample();
}
// Gaussian
d += _noise * random.nextGaussian();
// Convert the sample to a count
sample[n] = (int) Math.round(d + _bias);
}
int max = Maths.max(sample);
int[] h = new int[max + 1];
for (int s : sample)
h[s]++;
return h;
}
示例6: Well44497bGenerator
import org.apache.commons.math3.random.Well44497b; //导入依赖的package包/类
/** Constructor */
public Well44497bGenerator(long seed) {
this.seed = seed ;
rnd = new Well44497b(seed) ;
}
示例7: RandomStraightLinePointGenerator
import org.apache.commons.math3.random.Well44497b; //导入依赖的package包/类
/**
* The generator will create a cloud of points whose x-coordinates
* will be randomly sampled between {@code xLo} and {@code xHi}, and
* the corresponding y-coordinates will be computed as
* <pre><code>
* y = a x + b + N(0, error)
* </code></pre>
* where {@code N(mean, sigma)} is a Gaussian distribution with the
* given mean and standard deviation.
*
* @param a Slope.
* @param b Intercept.
* @param sigma Standard deviation on the y-coordinate of the point.
* @param lo Lowest value of the x-coordinate.
* @param hi Highest value of the x-coordinate.
* @param seed RNG seed.
*/
public RandomStraightLinePointGenerator(double a,
double b,
double sigma,
double lo,
double hi,
long seed) {
final RandomGenerator rng = new Well44497b(seed);
slope = a;
intercept = b;
error = new NormalDistribution(rng, 0, sigma,
NormalDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
x = new UniformRealDistribution(rng, lo, hi,
UniformRealDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
}