本文整理汇总了Java中org.apache.commons.math3.distribution.WeibullDistribution类的典型用法代码示例。如果您正苦于以下问题:Java WeibullDistribution类的具体用法?Java WeibullDistribution怎么用?Java WeibullDistribution使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WeibullDistribution类属于org.apache.commons.math3.distribution包,在下文中一共展示了WeibullDistribution类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFactory
import org.apache.commons.math3.distribution.WeibullDistribution; //导入依赖的package包/类
@Override
public DistributionFactory getFactory(List<String> params)
{
if (params.size() != 2)
throw new IllegalArgumentException("Invalid parameter list for extreme (Weibull) distribution: " + params);
try
{
String[] bounds = params.get(0).split("\\.\\.+");
final long min = parseLong(bounds[0]);
final long max = parseLong(bounds[1]);
if (min == max)
return new FixedFactory(min);
final double shape = Double.parseDouble(params.get(1));
WeibullDistribution findBounds = new WeibullDistribution(shape, 1d);
// max probability should be roughly equal to accuracy of (max-min) to ensure all values are visitable,
// over entire range, but this results in overly skewed distribution, so take sqrt
final double scale = (max - min) / findBounds.inverseCumulativeProbability(1d - Math.sqrt(1d/(max-min)));
return new ExtremeFactory(min, max, shape, scale);
} catch (Exception ignore)
{
throw new IllegalArgumentException("Invalid parameter list for extreme (Weibull) distribution: " + params);
}
}
示例2: getWeibull
import org.apache.commons.math3.distribution.WeibullDistribution; //导入依赖的package包/类
@Override
public RandomNumberDistribution<Double> getWeibull(
final RandomNumberStream rng, final Number alpha, final Number beta)
{
final RealDistribution dist = new WeibullDistribution(
RandomNumberStream.Util.asCommonsRandomGenerator(rng),
alpha.doubleValue(), beta.doubleValue());
return new RandomNumberDistribution<Double>()
{
@Override
public Double draw()
{
return dist.sample();
}
};
}
示例3: getFactory
import org.apache.commons.math3.distribution.WeibullDistribution; //导入依赖的package包/类
@Override
public DistributionFactory getFactory(List<String> params)
{
if (params.size() != 2)
throw new IllegalArgumentException("Invalid parameter list for extreme (Weibull) distribution: " + params);
try
{
String[] bounds = params.get(0).split("\\.\\.+");
final long min = parseLong(bounds[0]);
final long max = parseLong(bounds[1]);
final double shape = Double.parseDouble(params.get(1));
WeibullDistribution findBounds = new WeibullDistribution(shape, 1d);
// max probability should be roughly equal to accuracy of (max-min) to ensure all values are visitable,
// over entire range, but this results in overly skewed distribution, so take sqrt
final double scale = (max - min) / findBounds.inverseCumulativeProbability(1d - Math.sqrt(1d/(max-min)));
return new ExtremeFactory(min, max, shape, scale);
} catch (Exception e)
{
throw new IllegalArgumentException("Invalid parameter list for extreme (Weibull) distribution: " + params);
}
}
示例4: getFactory
import org.apache.commons.math3.distribution.WeibullDistribution; //导入依赖的package包/类
@Override
public DistributionFactory getFactory(List<String> params)
{
if (params.size() != 2)
throw new IllegalArgumentException("Invalid parameter list for extreme (Weibull) distribution: " + params);
try
{
String[] bounds = params.get(0).split("\\.\\.+");
final long min = Long.parseLong(bounds[0]);
final long max = Long.parseLong(bounds[1]);
final double shape = Double.parseDouble(params.get(1));
WeibullDistribution findBounds = new WeibullDistribution(shape, 1d);
// max probability should be roughly equal to accuracy of (max-min) to ensure all values are visitable,
// over entire range, but this results in overly skewed distribution, so take sqrt
final double scale = (max - min) / findBounds.inverseCumulativeProbability(1d - Math.sqrt(1d/(max-min)));
return new ExtremeFactory(min, max, shape, scale);
} catch (Exception _)
{
throw new IllegalArgumentException("Invalid parameter list for extreme (Weibull) distribution: " + params);
}
}
示例5: testNextWeibull
import org.apache.commons.math3.distribution.WeibullDistribution; //导入依赖的package包/类
@Test
public void testNextWeibull() {
double[] quartiles = TestUtils.getDistributionQuartiles(new WeibullDistribution(1.2, 2.1));
long[] counts = new long[4];
randomData.reSeed(1000);
for (int i = 0; i < 1000; i++) {
double value = randomData.nextWeibull(1.2, 2.1);
TestUtils.updateCounts(value, counts, quartiles);
}
TestUtils.assertChiSquareAccept(expected, counts, 0.001);
}
示例6: getNumericalMean
import org.apache.commons.math3.distribution.WeibullDistribution; //导入依赖的package包/类
@Override
public double getNumericalMean(Map<String, Double> parameters) throws Exception {
return new WeibullDistribution(parameters.get("alpha"), parameters.get("lambda")).getNumericalMean();
}
示例7: getDensityUnprocessed
import org.apache.commons.math3.distribution.WeibullDistribution; //导入依赖的package包/类
@Override
public double getDensityUnprocessed(double x, Map<String, Double> parameters) throws Exception {
return new WeibullDistribution(parameters.get("alpha"), parameters.get("lambda")).density(x);
}
示例8: getCumulativeProbabilityUnprocessed
import org.apache.commons.math3.distribution.WeibullDistribution; //导入依赖的package包/类
@Override
public double getCumulativeProbabilityUnprocessed(double x1, Map<String, Double> parameters) throws Exception {
return new WeibullDistribution(parameters.get("alpha"), parameters.get("lambda")).cumulativeProbability(x1);
}
示例9: get
import org.apache.commons.math3.distribution.WeibullDistribution; //导入依赖的package包/类
@Override
public Distribution get()
{
return new DistributionOffsetApache(new WeibullDistribution(new JDKRandomGenerator(), shape, scale, WeibullDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY), min, max);
}
示例10: get
import org.apache.commons.math3.distribution.WeibullDistribution; //导入依赖的package包/类
@Override
public Distribution get()
{
return new DistributionOffsetApache(new WeibullDistribution(shape, scale), min, max);
}
示例11: nextWeibull
import org.apache.commons.math3.distribution.WeibullDistribution; //导入依赖的package包/类
/**
* Generates a random value from the {@link WeibullDistribution Weibull Distribution}.
*
* @param shape the shape parameter of the Weibull distribution
* @param scale the scale parameter of the Weibull distribution
* @return random value sampled from the Weibull(shape, size) distribution
* @throws NotStrictlyPositiveException if {@code shape <= 0} or
* {@code scale <= 0}.
*/
public double nextWeibull(double shape, double scale) throws NotStrictlyPositiveException {
return new WeibullDistribution(getRandomGenerator(), shape, scale,
WeibullDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY).sample();
}
示例12: nextWeibull
import org.apache.commons.math3.distribution.WeibullDistribution; //导入依赖的package包/类
/**
* Generates a random value from the {@link WeibullDistribution Weibull Distribution}.
* This implementation uses {@link #nextInversionDeviate(RealDistribution) inversion}
* to generate random values.
*
* @param shape the shape parameter of the Weibull distribution
* @param scale the scale parameter of the Weibull distribution
* @return random value sampled from the Weibull(shape, size) distribution
* @since 2.2
*/
public double nextWeibull(double shape, double scale) {
return nextInversionDeviate(new WeibullDistribution(shape, scale));
}
示例13: WeibullDistr
import org.apache.commons.math3.distribution.WeibullDistribution; //导入依赖的package包/类
/**
* Instantiates a new Weibull pseudo random number generator.
*
* @param seed the seed
* @param alpha the alpha
* @param beta the beta
*/
public WeibullDistr(long seed, double alpha, double beta) {
super(new WeibullDistribution(alpha, beta), seed);
}
示例14: nextWeibull
import org.apache.commons.math3.distribution.WeibullDistribution; //导入依赖的package包/类
/**
* Generates a random value from the {@link WeibullDistribution Weibull Distribution}.
*
* @param shape the shape parameter of the Weibull distribution
* @param scale the scale parameter of the Weibull distribution
* @return random value sampled from the Weibull(shape, size) distribution
* @throws NotStrictlyPositiveException if {@code shape <= 0} or
* {@code scale <= 0}.
*/
public double nextWeibull(double shape, double scale) throws NotStrictlyPositiveException {
return new WeibullDistribution(getRan(), shape, scale,
WeibullDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY).sample();
}