本文整理汇总了Java中org.apache.commons.math3.distribution.NormalDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY属性的典型用法代码示例。如果您正苦于以下问题:Java NormalDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY属性的具体用法?Java NormalDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY怎么用?Java NormalDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.commons.math3.distribution.NormalDistribution
的用法示例。
在下文中一共展示了NormalDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY属性的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: RandomCirclePointGenerator
/**
* @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);
}
示例2: getKernel
/**
* The within-bin smoothing kernel. Returns a Gaussian distribution
* parameterized by {@code bStats}, unless the bin contains only one
* observation, in which case a constant distribution is returned.
*
* @param bStats summary statistics for the bin
* @return within-bin kernel parameterized by bStats
*/
protected RealDistribution getKernel(SummaryStatistics bStats) {
if (bStats.getN() == 1 || bStats.getVariance() == 0) {
return new ConstantRealDistribution(bStats.getMean());
} else {
return new NormalDistribution(randomData.getRandomGenerator(),
bStats.getMean(), bStats.getStandardDeviation(),
NormalDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
}
}
示例3: getKernel
/**
* The within-bin smoothing kernel. Returns a Gaussian distribution
* parameterized by {@code bStats}, unless the bin contains only one
* observation, in which case a constant distribution is returned.
*
* @param bStats summary statistics for the bin
* @return within-bin kernel parameterized by bStats
*/
protected RealDistribution getKernel(SummaryStatistics bStats) {
if (bStats.getN() == 1) {
return new ConstantRealDistribution(bStats.getMean());
} else {
return new NormalDistribution(randomData.getRandomGenerator(),
bStats.getMean(), bStats.getStandardDeviation(),
NormalDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
}
}
示例4: nextNormal
/**
* Generates a random value for the normal distribution with the mean equal to {@code mu} and standard deviation
* equal to {@code sigma}.
*
* @param mu the mean of the distribution
* @param sigma the standard deviation of the distribution
* @return a random value for the given normal distribution
*/
public static double nextNormal(final RandomGenerator rng, final double mu, final double sigma) {
final NormalDistribution normalDistribution =
new NormalDistribution(rng, mu, sigma, NormalDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
while (true) {
final double sample = normalDistribution.sample();
if (!Doubles.isFinite(sample)) {
logger.warn("Discarding non finite sample from normal distribution (mu={}, sigma={}): {}",
mu, sigma, sample);
continue;
}
return sample;
}
}
示例5: normal
/**
* A uniform sample ranging from 0 to sigma.
*
* @param rng the rng to use
* @param mean, the matrix mean from which to generate values from
* @param sigma the standard deviation to use to generate the gaussian noise
* @return a uniform sample of the given shape and size
* <p/>
* with numbers between 0 and 1
*/
public static INDArray normal(RandomGenerator rng, INDArray mean, INDArray sigma) {
INDArray iter = mean.reshape(new int[]{1,mean.length()}).dup();
INDArray sigmaLinear = sigma.ravel();
for(int i = 0; i < iter.length(); i++) {
RealDistribution reals = new NormalDistribution(rng, mean.getFloat(i), FastMath.sqrt((double) sigmaLinear.getFloat(i)),NormalDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
iter.putScalar(i,reals.sample());
}
return iter.reshape(mean.shape());
}
示例6: genGaussianNoise
public INDArray genGaussianNoise(int id){
if(!currentNoise.containsKey(id)){
INDArray zeroMean = Nd4j.zeros(inputSize, outputSize);
currentNoise.put(id,Sampling.normal(RandomUtils.getRandomGenerator(id), zeroMean, noiseVar));
}
else{
RealDistribution reals = new NormalDistribution(RandomUtils.getRandomGenerator(id),0, noiseVarSqrt,NormalDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
INDArrayUtils.shiftLeft(currentNoise.get(id), inputSize, outputSize, RandomUtils.getRandomGenerator(id).nextInt(inputSize*outputSize), reals.sample());
}
// currentNoise = Sampling.normal(RandomUtils.getRandomGenerator(id), zeroMean, noiseVar);
return currentNoise.get(id);
}
示例7: genGaussianNoise
public INDArray genGaussianNoise(int id){
if(!currentNoise.containsKey(id)){
INDArray zeroMean = Nd4j.zeros(outputSize);
currentNoise.put(id,Sampling.normal(RandomUtils.getRandomGenerator(id), zeroMean, noiseVar));
}
else{
RealDistribution reals = new NormalDistribution(RandomUtils.getRandomGenerator(id),0, noiseVarSqrt,NormalDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
INDArrayUtils.shiftLeft(currentNoise.get(id), outputSize, RandomUtils.getRandomGenerator(id).nextInt(outputSize), reals.sample());
}
return currentNoise.get(id);
}
示例8: getKernel
/**
* The within-bin smoothing kernel.
*
* @param bStats summary statistics for the bin
* @return within-bin kernel parameterized by bStats
*/
protected RealDistribution getKernel(SummaryStatistics bStats) {
// Default to Gaussian
return new NormalDistribution(randomData.getRandomGenerator(),
bStats.getMean(), bStats.getStandardDeviation(),
NormalDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
}
示例9: get
@Override
public Distribution get()
{
return new DistributionBoundApache(new NormalDistribution(new JDKRandomGenerator(), mean, stdev, NormalDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY), min, max);
}
示例10: rNorm
/**
* Return a random value from a normal distribution with the given mean and standard deviation
*
* @param mean
* a double mean value
* @param sd
* a double standard deviation
* @return a double sample
*/
public static double rNorm(double mean, double sd) {
RealDistribution dist = new NormalDistribution(RANDOM.getRandomGenerator(),
mean,
sd,
NormalDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
return dist.sample();
}
示例11: RandomStraightLinePointGenerator
/**
* 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);
}