You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ch...@apache.org on 2015/08/25 10:55:28 UTC
flink git commit: [FLINK-2564] [core] Improve stability of
RandomSamplerTest
Repository: flink
Updated Branches:
refs/heads/master cf88407a5 -> 5156a1b3f
[FLINK-2564] [core] Improve stability of RandomSamplerTest
- Expand the verification boundary for random sampler test
- Increase the number of times we sample
This closes #1047
Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/5156a1b3
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/5156a1b3
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/5156a1b3
Branch: refs/heads/master
Commit: 5156a1b3f82c2362481812dfee480823ac492975
Parents: cf88407
Author: chengxiang li <ch...@intel.com>
Authored: Mon Aug 24 17:49:44 2015 +0800
Committer: Chiwan Park <ch...@apache.org>
Committed: Tue Aug 25 17:55:03 2015 +0900
----------------------------------------------------------------------
.../apache/flink/api/java/sampling/RandomSamplerTest.java | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flink/blob/5156a1b3/flink-java/src/test/java/org/apache/flink/api/java/sampling/RandomSamplerTest.java
----------------------------------------------------------------------
diff --git a/flink-java/src/test/java/org/apache/flink/api/java/sampling/RandomSamplerTest.java b/flink-java/src/test/java/org/apache/flink/api/java/sampling/RandomSamplerTest.java
index 83e5b41..83a95ae 100644
--- a/flink-java/src/test/java/org/apache/flink/api/java/sampling/RandomSamplerTest.java
+++ b/flink-java/src/test/java/org/apache/flink/api/java/sampling/RandomSamplerTest.java
@@ -239,14 +239,14 @@ public class RandomSamplerTest {
sampler = new BernoulliSampler<Double>(fraction);
}
- // take 5 times sample, and take the average result size for next step comparison.
+ // take 20 times sample, and take the average result size for next step comparison.
int totalSampledSize = 0;
- double sampleCount = 5;
+ double sampleCount = 20;
for (int i = 0; i < sampleCount; i++) {
totalSampledSize += getSize(sampler.sample(source.iterator()));
}
double resultFraction = totalSampledSize / ((double) SOURCE_SIZE * sampleCount);
- assertTrue(String.format("expected fraction: %f, result fraction: %f", fraction, resultFraction), Math.abs((resultFraction - fraction) / fraction) < 0.1);
+ assertTrue(String.format("expected fraction: %f, result fraction: %f", fraction, resultFraction), Math.abs((resultFraction - fraction) / fraction) < 0.2);
}
/*
@@ -440,13 +440,13 @@ public class RandomSamplerTest {
}
/*
- * Calculate the D value of K-S test for p-value 0.05, m and n are the sample size
+ * Calculate the D value of K-S test for p-value 0.01, m and n are the sample size
*/
private double getDValue(int m, int n) {
Preconditions.checkArgument(m > 0, "input sample size should be positive.");
Preconditions.checkArgument(n > 0, "input sample size should be positive.");
double first = (double) m;
double second = (double) n;
- return 1.36 * Math.sqrt((first + second) / (first * second));
+ return 1.63 * Math.sqrt((first + second) / (first * second));
}
}