Spaces:
Runtime error
Runtime error
JP-SystemsX commited on
Commit ·
0a60649
1
Parent(s): a9b8c5a
Delete Testing.py
Browse files- Testing.py +0 -33
Testing.py
DELETED
|
@@ -1,33 +0,0 @@
|
|
| 1 |
-
import evaluate as ev
|
| 2 |
-
from nDCG import nDCG
|
| 3 |
-
|
| 4 |
-
metric = nDCG(cache_dir="cache")
|
| 5 |
-
a = [1,2,3,4,5]
|
| 6 |
-
b = [1,2,3,4,5]
|
| 7 |
-
c = [1,2,3,4,0]
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
#metric.add(prediction=a, reference=b)
|
| 11 |
-
metric.add(prediction=c, reference=b)
|
| 12 |
-
metric.add(prediction=c, reference=b)
|
| 13 |
-
metric.add(prediction=c, reference=b)
|
| 14 |
-
print(metric.compute(predictions=[a], references=[b]))
|
| 15 |
-
print(metric.compute(predictions=[a], references=[c]))
|
| 16 |
-
print(metric.compute(predictions=[a], references=[c]))
|
| 17 |
-
print(metric.compute(predictions=[a,a], references=[c,a]))
|
| 18 |
-
print(metric.cache_file_name)
|
| 19 |
-
|
| 20 |
-
nDCG_metric = ev.load("nDCG.py")
|
| 21 |
-
results = nDCG_metric.compute(references=[[10, 0, 0, 1, 5]], predictions=[[.1, .2, .3, 4, 70]])
|
| 22 |
-
print(results)
|
| 23 |
-
|
| 24 |
-
nDCG_metric = ev.load("nDCG.py")
|
| 25 |
-
results = nDCG_metric.compute(references=[[10, 0, 0, 1, 5]], predictions=[[.1, .2, .3, 4, 70]], k=3)
|
| 26 |
-
print(results)
|
| 27 |
-
|
| 28 |
-
nDCG_metric = ev.load("nDCG.py")
|
| 29 |
-
results = nDCG_metric.compute(references=[[1, 0, 0, 0, 0]], predictions=[[1, 1, 0, 0, 0]], k=1)
|
| 30 |
-
print(results)
|
| 31 |
-
|
| 32 |
-
results = nDCG_metric.compute(references=[[1, 0, 0, 0, 0]], predictions=[[1, 1, 0, 0, 0]], k=1, ignore_ties=True)
|
| 33 |
-
print(results)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|