Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

import java.io.IOException;
import java.time.Instant;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
Expand Down Expand Up @@ -88,6 +89,9 @@ public void testSingleNumericFeatureAndMixedTrainingAndNonTrainingRows() throws

int trainingDocsWithEmptyFeatureImportance = 0;
int testDocsWithEmptyFeatureImportance = 0;

// for debugging
List<Map<String, Object>> badDocuments = new ArrayList<>();
SearchResponse sourceData = client().prepareSearch(sourceIndex).setTrackTotalHits(true).setSize(1000).get();
for (SearchHit hit : sourceData.getHits()) {
Map<String, Object> destDoc = getDestDoc(config, hit);
Expand All @@ -107,6 +111,7 @@ public void testSingleNumericFeatureAndMixedTrainingAndNonTrainingRows() throws
List<Map<String, Object>> importanceArray = (List<Map<String, Object>>)resultsObject.get("feature_importance");

if (importanceArray.isEmpty()) {
badDocuments.add(destDoc);
if (Boolean.TRUE.equals(resultsObject.get("is_training"))) {
trainingDocsWithEmptyFeatureImportance++;
} else {
Expand All @@ -126,7 +131,9 @@ public void testSingleNumericFeatureAndMixedTrainingAndNonTrainingRows() throws
// If feature importance was empty for some of the docs this assertion helps us
// understand whether the offending docs were training or test docs.
assertThat("There were [" + trainingDocsWithEmptyFeatureImportance + "] training docs and ["
+ testDocsWithEmptyFeatureImportance + "] test docs with empty feature importance",
+ testDocsWithEmptyFeatureImportance + "] test docs with empty feature importance"
+ " from " + sourceData.getHits().getTotalHits().value + " hits.\n"
+ badDocuments,
trainingDocsWithEmptyFeatureImportance + testDocsWithEmptyFeatureImportance, equalTo(0));

assertProgressComplete(jobId);
Expand Down