MATH-1411: Relaxing tolerance.
Unit test now succeeds reasonably often, even when using a random seed.
This commit is contained in:
parent
2977d26a0f
commit
bab2a8b991
|
@ -252,11 +252,9 @@ public class LevenbergMarquardtOptimizerTest
|
||||||
final double ySigma = 15;
|
final double ySigma = 15;
|
||||||
final double radius = 111.111;
|
final double radius = 111.111;
|
||||||
// The test is extremely sensitive to the seed.
|
// The test is extremely sensitive to the seed.
|
||||||
final long seed = 59321761419L;
|
|
||||||
final RandomCirclePointGenerator factory
|
final RandomCirclePointGenerator factory
|
||||||
= new RandomCirclePointGenerator(xCenter, yCenter, radius,
|
= new RandomCirclePointGenerator(xCenter, yCenter, radius,
|
||||||
xSigma, ySigma,
|
xSigma, ySigma);
|
||||||
seed);
|
|
||||||
final CircleProblem circle = new CircleProblem(xSigma, ySigma);
|
final CircleProblem circle = new CircleProblem(xSigma, ySigma);
|
||||||
|
|
||||||
final int numPoints = 10;
|
final int numPoints = 10;
|
||||||
|
@ -276,8 +274,8 @@ public class LevenbergMarquardtOptimizerTest
|
||||||
final double[] asymptoticStandardErrorFound = optimum.getSigma(1e-14).toArray();
|
final double[] asymptoticStandardErrorFound = optimum.getSigma(1e-14).toArray();
|
||||||
|
|
||||||
// Check that the parameters are found within the assumed error bars.
|
// Check that the parameters are found within the assumed error bars.
|
||||||
Assert.assertEquals(xCenter, paramFound[0], asymptoticStandardErrorFound[0]);
|
Assert.assertEquals(xCenter, paramFound[0], 1.5 * asymptoticStandardErrorFound[0]);
|
||||||
Assert.assertEquals(yCenter, paramFound[1], asymptoticStandardErrorFound[1]);
|
Assert.assertEquals(yCenter, paramFound[1], 1.5 * asymptoticStandardErrorFound[1]);
|
||||||
Assert.assertEquals(radius, paramFound[2], asymptoticStandardErrorFound[2]);
|
Assert.assertEquals(radius, paramFound[2], asymptoticStandardErrorFound[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -289,11 +287,9 @@ public class LevenbergMarquardtOptimizerTest
|
||||||
final double xSigma = 10;
|
final double xSigma = 10;
|
||||||
final double ySigma = 15;
|
final double ySigma = 15;
|
||||||
final double radius = 111.111;
|
final double radius = 111.111;
|
||||||
final long seed = 3456789L;
|
|
||||||
final RandomCirclePointGenerator factory
|
final RandomCirclePointGenerator factory
|
||||||
= new RandomCirclePointGenerator(xCenter, yCenter, radius,
|
= new RandomCirclePointGenerator(xCenter, yCenter, radius,
|
||||||
xSigma, ySigma,
|
xSigma, ySigma);
|
||||||
seed);
|
|
||||||
final CircleProblem circle = new CircleProblem(xSigma, ySigma);
|
final CircleProblem circle = new CircleProblem(xSigma, ySigma);
|
||||||
|
|
||||||
final int numPoints = 10;
|
final int numPoints = 10;
|
||||||
|
|
|
@ -50,9 +50,8 @@ public class RandomCirclePointGenerator {
|
||||||
double y,
|
double y,
|
||||||
double radius,
|
double radius,
|
||||||
double xSigma,
|
double xSigma,
|
||||||
double ySigma,
|
double ySigma) {
|
||||||
long seed) {
|
final UniformRandomProvider rng = RandomSource.create(RandomSource.WELL_44497_B);
|
||||||
final UniformRandomProvider rng = RandomSource.create(RandomSource.WELL_44497_B, seed);
|
|
||||||
this.radius = radius;
|
this.radius = radius;
|
||||||
cX = new NormalDistribution(x, xSigma).createSampler(rng);
|
cX = new NormalDistribution(x, xSigma).createSampler(rng);
|
||||||
cY = new NormalDistribution(y, ySigma).createSampler(rng);
|
cY = new NormalDistribution(y, ySigma).createSampler(rng);
|
||||||
|
|
Loading…
Reference in New Issue