[ML] relaxing parameters on stratified split test (#54127) (#54168)

Relaxing the error rate a bit on two of the tests.
Ran 1000s of times locally and never had a failure after these changes. 

closes https://github.com/elastic/elasticsearch/issues/54122
This commit is contained in:
Benjamin Trent 2020-03-25 08:06:15 -04:00 committed by GitHub
parent b066cc587d
commit ef05a4f416
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -179,8 +179,8 @@ public class StratifiedCrossValidationSplitterTests extends ESTestCase {
double expectedTotalTrainingCount = ROWS_COUNT * trainingFraction; double expectedTotalTrainingCount = ROWS_COUNT * trainingFraction;
assertThat(trainingDocsCount + testDocsCount, equalTo((long) ROWS_COUNT)); assertThat(trainingDocsCount + testDocsCount, equalTo((long) ROWS_COUNT));
assertThat(trainingDocsCount, greaterThanOrEqualTo((long) Math.floor(expectedTotalTrainingCount - 1))); assertThat(trainingDocsCount, greaterThanOrEqualTo((long) (expectedTotalTrainingCount - 2)));
assertThat(trainingDocsCount, lessThanOrEqualTo((long) Math.ceil(expectedTotalTrainingCount + 1))); assertThat(trainingDocsCount, lessThanOrEqualTo((long) Math.ceil(expectedTotalTrainingCount) + 2));
for (String classValue : classCardinalities.keySet()) { for (String classValue : classCardinalities.keySet()) {
double expectedClassTrainingCount = totalRowsPerClass.get(classValue) * trainingFraction; double expectedClassTrainingCount = totalRowsPerClass.get(classValue) * trainingFraction;
@ -221,7 +221,7 @@ public class StratifiedCrossValidationSplitterTests extends ESTestCase {
// should be close to the training percent, which is set to 0.5 // should be close to the training percent, which is set to 0.5
for (int rowTrainingCount : trainingCountPerRow) { for (int rowTrainingCount : trainingCountPerRow) {
double meanCount = rowTrainingCount / (double) runCount; double meanCount = rowTrainingCount / (double) runCount;
assertThat(meanCount, is(closeTo(0.5, 0.1))); assertThat(meanCount, is(closeTo(0.5, 0.12)));
} }
} }