Spaces:
Runtime error
Runtime error
JP-SystemsX
commited on
Commit
·
220984d
1
Parent(s):
fd58845
Minor tweaks
Browse files
README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
---
|
2 |
title: nDCG
|
3 |
emoji: 👁
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: gradio
|
7 |
sdk_version: 3.9.1
|
8 |
app_file: app.py
|
|
|
1 |
---
|
2 |
title: nDCG
|
3 |
emoji: 👁
|
4 |
+
colorFrom: red
|
5 |
+
colorTo: blue
|
6 |
sdk: gradio
|
7 |
sdk_version: 3.9.1
|
8 |
app_file: app.py
|
app.py
CHANGED
@@ -9,7 +9,7 @@ from evaluate.utils.logging import get_logger
|
|
9 |
logger = get_logger(__name__)
|
10 |
REGEX_YAML_BLOCK = re.compile(r"---[\n\r]+([\S\s]*?)[\n\r]+---[\n\r]")
|
11 |
|
12 |
-
module = evaluate.load("nDCG
|
13 |
|
14 |
def launch_gradio_widget(metric):
|
15 |
"""Launches `metric` widget with Gradio."""
|
|
|
9 |
logger = get_logger(__name__)
|
10 |
REGEX_YAML_BLOCK = re.compile(r"---[\n\r]+([\S\s]*?)[\n\r]+---[\n\r]")
|
11 |
|
12 |
+
module = evaluate.load("JP-SystemsX/nDCG")
|
13 |
|
14 |
def launch_gradio_widget(metric):
|
15 |
"""Launches `metric` widget with Gradio."""
|
nDCG.py
CHANGED
@@ -66,13 +66,13 @@ Examples:
|
|
66 |
>>> print(results)
|
67 |
{'nDCG@3': 0.4123818817534531}
|
68 |
Example 3-There is only one relevant label, but there is a tie and the model can't decide which one is the one.
|
69 |
-
>>>
|
70 |
>>> results = nDCG_metric.compute(references=[[1, 0, 0, 0, 0]], predictions=[[1, 1, 0, 0, 0]], k=1)
|
71 |
>>> print(results)
|
72 |
{'nDCG@1': 0.5}
|
73 |
>>> #That is it calculates both and returns the average of both
|
74 |
Example 4-The Same as 3, except ignore_ties is set to True.
|
75 |
-
>>>
|
76 |
>>> results = nDCG_metric.compute(references=[[1, 0, 0, 0, 0]], predictions=[[1, 1, 0, 0, 0]], k=1, ignore_ties=True)
|
77 |
>>> print(results)
|
78 |
{'nDCG@1': 0.0}
|
|
|
66 |
>>> print(results)
|
67 |
{'nDCG@3': 0.4123818817534531}
|
68 |
Example 3-There is only one relevant label, but there is a tie and the model can't decide which one is the one.
|
69 |
+
>>> nDCG_metric = evaluate.load("JP-SystemsX/nDCG")
|
70 |
>>> results = nDCG_metric.compute(references=[[1, 0, 0, 0, 0]], predictions=[[1, 1, 0, 0, 0]], k=1)
|
71 |
>>> print(results)
|
72 |
{'nDCG@1': 0.5}
|
73 |
>>> #That is it calculates both and returns the average of both
|
74 |
Example 4-The Same as 3, except ignore_ties is set to True.
|
75 |
+
>>> nDCG_metric = evaluate.load("JP-SystemsX/nDCG")
|
76 |
>>> results = nDCG_metric.compute(references=[[1, 0, 0, 0, 0]], predictions=[[1, 1, 0, 0, 0]], k=1, ignore_ties=True)
|
77 |
>>> print(results)
|
78 |
{'nDCG@1': 0.0}
|