Skip to content

Commit

Permalink
Testing
Browse files Browse the repository at this point in the history
Signed-off-by: Heemin Kim <[email protected]>
  • Loading branch information
heemin32 committed Jul 29, 2024
1 parent dda9293 commit 85f1398
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 19 deletions.
19 changes: 0 additions & 19 deletions src/test/java/org/opensearch/knn/integ/BinaryIndexIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@

import java.io.IOException;
import java.net.URL;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

import static org.opensearch.knn.common.KNNConstants.METHOD_HNSW;

Expand Down Expand Up @@ -87,23 +85,6 @@ public void testFaissHnswBinary_whenSmallDataSet_thenCreateIngestQueryWorks() {
}
}

@SneakyThrows
public void testFaissHnswBinary_when1000Data_thenRecallIsAboveNinePointZero() {
// Create Index
createKnnHnswBinaryIndex(KNNEngine.FAISS, INDEX_NAME, FIELD_NAME, 128);
ingestTestData(INDEX_NAME, FIELD_NAME);

int k = 100;
for (int i = 0; i < testData.queries.length; i++) {
List<KNNResult> knnResults = runKnnQuery(INDEX_NAME, FIELD_NAME, testData.queries[i], k);
float recall = getRecall(
Set.of(Arrays.copyOf(testData.groundTruthValues[i], k)),
knnResults.stream().map(KNNResult::getDocId).collect(Collectors.toSet())
);
assertTrue("Recall: " + recall, recall > 0.9);
}
}

@SneakyThrows
public void testFaissHnswBinary_whenRadialSearch_thenThrowException() {
// Create Index
Expand Down
3 changes: 3 additions & 0 deletions src/test/java/org/opensearch/knn/integ/IndexIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ public void testFaissHnsw_when1000Data_thenRecallIsAboveNinePointZero() {
Set.of(Arrays.copyOf(testData.groundTruthValues[i], k)),
knnResults.stream().map(KNNResult::getDocId).collect(Collectors.toSet())
);
System.out.println("testFaissHnsw_when1000Data_thenRecallIsAboveNinePointZero");
System.out.println("Line: " + i);
System.out.println(knnResults.stream().map(KNNResult::getDocId).collect(Collectors.toList()));
assertTrue("Recall: " + recall, recall > 0.9);
}
}
Expand Down

0 comments on commit 85f1398

Please sign in to comment.