-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
013fab2
commit df5d9a1
Showing
7 changed files
with
84 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
opensearch-search-quality-evaluation-plugin/scripts/run-query-set.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...lity-evaluation-plugin/src/test/java/org/opensearch/eval/metrics/DcgSearchMetricTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
package org.opensearch.eval.metrics; | ||
|
||
import org.opensearch.test.OpenSearchTestCase; | ||
|
||
import java.util.List; | ||
|
||
public class DcgSearchMetricTest extends OpenSearchTestCase { | ||
|
||
public void testCalculate() { | ||
|
||
final int k = 5; | ||
final List<Double> relevanceScores = List.of(1.0, 2.0, 3.0, 1.0, 2.0, 3.0, 1.0, 2.0, 3.0, 0.0); | ||
|
||
final DcgSearchMetric dcgSearchMetric = new DcgSearchMetric(k, relevanceScores); | ||
final double dcg = dcgSearchMetric.calculate(); | ||
|
||
assertEquals(13.864412483585935, dcg, 0.0); | ||
|
||
} | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
...ity-evaluation-plugin/src/test/java/org/opensearch/eval/metrics/NdcgSearchMetricTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
package org.opensearch.eval.metrics; | ||
|
||
import org.opensearch.test.OpenSearchTestCase; | ||
|
||
import java.util.List; | ||
|
||
public class NdcgSearchMetricTest extends OpenSearchTestCase { | ||
|
||
public void testCalculate() { | ||
|
||
final int k = 5; | ||
final List<Double> relevanceScores = List.of(1.0, 2.0, 3.0, 1.0, 2.0, 3.0, 1.0, 2.0, 3.0, 0.0); | ||
|
||
final NdcgSearchMetric ndcgSearchMetric = new NdcgSearchMetric(k, relevanceScores); | ||
final double dcg = ndcgSearchMetric.calculate(); | ||
|
||
assertEquals(0.7151195094457645, dcg, 0.0); | ||
|
||
} | ||
|
||
} |