Interface to ndeval.c
Project description
pyndeval
A python interface to TREC's ndeval.c
, used for computing diversity retrieval metrics.
Getting Started
python setup.py install
Usage
import pyndeval
from pyndeval import SubtopicQrel, ScoredDoc
# provide qrels as a list of tuples
qrels = [
SubtopicQrel("0", "a", "A", 1),
SubtopicQrel("0", "b", "B", 1),
SubtopicQrel("0", "b", "D", 1),
SubtopicQrel("0", "c", "C", 1),
]
# provide run as a list of tuples
run = [
ScoredDoc("0", "A", 9.3),
ScoredDoc("0", "D", 8.4),
ScoredDoc("0", "E", 8.1), # not in qrels
ScoredDoc("0", "B", 7.6),
# C not retrieved
]
pyndeval.ndeval(qrels, run)
{'0': {
'ERR-IA@5': 0.3933,
'ERR-IA@10': 0.3907,
'ERR-IA@20': 0.3907,
'nERR-IA@5': 0.8297,
'nERR-IA@10': 0.8297,
'nERR-IA@20': 0.8297,
'alpha-DCG@5': 0.4052,
'alpha-DCG@10': 0.3998,
'alpha-DCG@20': 0.3997,
'alpha-nDCG@5': 0.7868,
'alpha-nDCG@10': 0.7868,
'alpha-nDCG@20': 0.7868,
'NRBP': 0.3906,
'nNRBP': 0.8620,
'MAP-IA': 0.5000,
'P-IA@5': 0.2000,
'P-IA@10': 0.1000,
'P-IA@20': 0.0500,
'strec@5': 0.6666,
'strec@10': 0.6666,
'strec@20': 0.6666
}}
Supported measures
pyndeval
supports the following measures:
ERR-IA@k
nERR-IA@k
alpha-DCG@k
alpha-nDCG@k
P-IA@k
strec@k
NRBP
nNRBP
MAP-IA
Measures with @k
support values from 1-20 (upper limit from ndeval.c
).
Measures are provided as a list of strings with the measures=
parameter.
pyndeval.ndeval(qrels, run, measures=["ERR-IA@7", "MAP-IA"])
Reusing qrels
If you're running multiple times for the same set of qrels and measures, you can speed it up by
building a RelevanceEvaluator
object, which caches the internal qrel representations.
ev = pyndeval.RelevanceEvaluator(qrels)
ev.evaluate(run1)
ev.evaluate(run2)
ev.evaluate(run3)
ev.evaluate(run4)
Iterable results
for result in pyndeval.ndeval_iter(qrels, run):
{"query_id": "0", ...}
for result in ev.evaluate_iter(run):
{"query_id": "0", ...}
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyndeval-0.0.2.tar.gz
(14.4 kB
view hashes)
Built Distributions
Close
Hashes for pyndeval-0.0.2-pp37-pypy37_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d07867dc0b7952388b1897fd037221069eb2b3103f4f8fd3eddfe24a8da58bb0 |
|
MD5 | 7432facc6330bde9e402529e00c7c4fc |
|
BLAKE2b-256 | 56701795bc89d565f39e183f3023ecabcc57f3e0a3e72224937b8fb5f9ae1b8b |
Close
Hashes for pyndeval-0.0.2-pp37-pypy37_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe7b596ad8b089fe2c406bc453544386032aa9ef77a26be9018640bbc1313395 |
|
MD5 | 527f18e55a5080427e1ade72af41c89f |
|
BLAKE2b-256 | b2b7b121b415d8b7474abf844cb07c0cb8da48aba22eb4dbc5b6bfdb3c3e94cb |
Close
Hashes for pyndeval-0.0.2-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f81d21a00ca3f7abe0db9af6f0cd961284ad112e59beca7cccc571d355920a90 |
|
MD5 | 399285fe4a0c28faecd2a1f307ac0d89 |
|
BLAKE2b-256 | 36bd2b7f2c204e351c11d8e912994f6b27daba63d1e012876fce9158f70a7f45 |
Close
Hashes for pyndeval-0.0.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 90e13013d7f227026de3284673a39b6bd8fbaeced4255f950c1e138d5e1d4451 |
|
MD5 | 6805d569365ecc9a762a8f80df585f7a |
|
BLAKE2b-256 | aacd793cdee05afeaf54dbd7ca82ae367b15c8fc9e035e0452e84aa84cf35072 |
Close
Hashes for pyndeval-0.0.2-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c319ae72188b98e8c5eb00634af984e4e11800d53f7a410d71ba7b361a045b2 |
|
MD5 | 4217eb1b73f13cb87bd22c94bcf75479 |
|
BLAKE2b-256 | 92d51de58d34b6afda67062635c4cdf93d8c21676bf95d5945e022077ca221a9 |
Close
Hashes for pyndeval-0.0.2-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6840e1a4ac8bb4781f2c665e44ee741279202c31a5a8858b85b2f60762d63bd |
|
MD5 | 9037237c568f4e162d9f5fc71675b1aa |
|
BLAKE2b-256 | be5d62a68bc48e0b9c737ca3c13d044db922e9062a157ad11fe099f1c27d1146 |
Close
Hashes for pyndeval-0.0.2-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34cb06706dad9b26885278791897ea8597a0c33f972dd8a51f407c81852718f4 |
|
MD5 | 5bfd1d7cff0e7b8bd4faa0e1eeba78cc |
|
BLAKE2b-256 | 9dd0c2a6807757e8a07ff6809626fa68a8ad9e14057f57cb58c00a30229e66bc |
Close
Hashes for pyndeval-0.0.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 11ef2b481646f4f201e2c37292d07921eedaa0aedcc4d8a5e554fbdd971821ff |
|
MD5 | 9b5af8b68e1c33cf28144f358720b21d |
|
BLAKE2b-256 | 1d7efe63e7f78a7f42570673430c1a6ef5c5841c79c1c34cd4029d6ae0e1ca6c |
Close
Hashes for pyndeval-0.0.2-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5efd291efd8a21e560d5315231a71319d5db5869363bf80fe07f391c8fee2ff2 |
|
MD5 | 3f0bf1353cb9e9d7d965e8a7e371341b |
|
BLAKE2b-256 | a0308d88d9212d6f87963ea21034c4bec91fd5b1e11bc97fe16d7203f2be202d |
Close
Hashes for pyndeval-0.0.2-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a263f7f0b6399f799a602e6fe11c502b0b89ec13ebd1f8cb7de84dda2dd2a47 |
|
MD5 | ed510c80c0f8b1bfc9178f5b1db4a67f |
|
BLAKE2b-256 | a13cd0186ab0c0b2cc12cc3a0a3964c41531f5098d356070791c9cd2d171cc24 |
Close
Hashes for pyndeval-0.0.2-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b4296f76735a71b10b6b07bbbfd0b51c7728c1cd86f3c4506c291119b6eb11ce |
|
MD5 | 0b49eff831ee87ee03ede0791afcf986 |
|
BLAKE2b-256 | a556a58075fac99f869919769127f1fc7c2ccbf560aaeba0b35881a96a17a7ab |
Close
Hashes for pyndeval-0.0.2-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | da791fffa5d8a204bc4d18355edb217fc046acc75994ad2e6c10973125c9f3cf |
|
MD5 | 47ffab98a1154bcc420180e68d2a2dd1 |
|
BLAKE2b-256 | 39625b820ebfcdd195b0ca72da4f999b4a6f4cc07ebc573097a0ec2f1b37308a |
Close
Hashes for pyndeval-0.0.2-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96abd65db59ee4f1fb3ec054508e6a72198ae4867a03831a43f76b35cd123e22 |
|
MD5 | 5add4086026b7e3d18af93d7d35e46c2 |
|
BLAKE2b-256 | 3c26e9cd1533467c66b87ce355573ded38f7c038944c179cf4c165271571e398 |
Close
Hashes for pyndeval-0.0.2-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7fe722a2e5a38c182d576c817647d075b30b391b10fbf711b7aa97d9ed161a9 |
|
MD5 | 8cd948447c29feb46421c676b2ec286b |
|
BLAKE2b-256 | 278857f472f410f883d93af5224e851a8aa58fa4f68224096a02ece6fc35c66a |
Close
Hashes for pyndeval-0.0.2-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 84031a6adf750bfb19759d1061029cc96116d2d7b0c3d87b8275f24f5dd9a279 |
|
MD5 | 6684a26981fd48bb5345df5e521047f8 |
|
BLAKE2b-256 | 46bd3927b40ed336f8238a2e0bd23062211bc2017253bdf7d0e7d358f69cbca6 |
Close
Hashes for pyndeval-0.0.2-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fda7f38279b259e28f9b29e0253212387ad512967288614fb1fbd400fdde2291 |
|
MD5 | a6470a2cb835eaee3c9825fcfd73da82 |
|
BLAKE2b-256 | bb96f5dac9d940ae25af89e145bf67417b3a5b56f787e4328a0573281b2f9697 |
Close
Hashes for pyndeval-0.0.2-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 014b346b49d9e23cfe2e5cab6db56151da33707d63a42a9c2255c77ee0e958e4 |
|
MD5 | 6125bb6332f74c853d2862c5b2073d96 |
|
BLAKE2b-256 | e644a06bf1fe8ba81bf85273380e0a5c1beda74cc292606a529d80b2163321ea |
Close
Hashes for pyndeval-0.0.2-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 962929ebb9f87c26862913299f7775e839b60b94618cabe0ce49ded63fe70a06 |
|
MD5 | a8d17160810aa59f4c4cdd1a4726ac9a |
|
BLAKE2b-256 | 0ef2837c4bcad21dd726688e406b6888d48f8300acb090f6fd3e3e61cf831363 |