Interface to ndeval.c
Project description
pyndeval
A python interface to TREC's ndeval.c
, used for computing diversity retrieval metrics.
Getting Started
From pip:
pip install pyndeval
Or install from source:
git clone https://github.com/seanmacavaney/pyndeval.git
cd pyndeval
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.3.tar.gz
(14.4 kB
view hashes)
Built Distributions
Close
Hashes for pyndeval-0.0.3-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c81de170ee7db3296e05f8caf41e3d42f8c5f5f65e19d6d736a6fde38d53476 |
|
MD5 | edcf4b0dcc31304c24d63710c87ed1b9 |
|
BLAKE2b-256 | 1edc08c58d92bc57d78279f8ec40ad391e21446b819a2ee942f3830a88ded47f |
Close
Hashes for pyndeval-0.0.3-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a52a8a4ec02bddde3eb92e9d94b3ee6bc52e298fd02c7cc0fd41269a1ca411ab |
|
MD5 | eac222e92a1cd07fb2afc3e49f751b32 |
|
BLAKE2b-256 | 2ff3ab1b94f50dec049e16787a680337f7153f366bcf14be1445acad0a84cda4 |
Close
Hashes for pyndeval-0.0.3-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 43efcb9b81891de86a92fa62eee8dd2bfe17148481f83b089b1aef18e4446b5f |
|
MD5 | f696281b4eb35cdb57675925c4bcd42e |
|
BLAKE2b-256 | c73a888ad082145595f8197a81378d460b38d80a550bb6a5c0ce78d8a4fc2939 |
Close
Hashes for pyndeval-0.0.3-pp38-pypy38_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27b5207e0e77fbd7f18309fd82c0d885c57c53e246581a95997ec4c835e7cddb |
|
MD5 | 6609b26887d288e2dce9253d1e7fb503 |
|
BLAKE2b-256 | f05dcb3acd1c1f630acf23b7346e93e865fceee49bcc6741a18399a4caff0fdc |
Close
Hashes for pyndeval-0.0.3-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c8fc013c8e1350e97615a6e78c8272b9ae5e4ac2ab38920adab0b7daed4c483e |
|
MD5 | 6121df17f091030c9c882574190a6027 |
|
BLAKE2b-256 | c8600048a68f51022fdddaa32a3ed1c4d5d2026bbbd70b854770b2f4e54c57d0 |
Close
Hashes for pyndeval-0.0.3-pp37-pypy37_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 543dd97b4717ed63e3ba35d90a90888f10035898ba0ab9a94189c1255e177621 |
|
MD5 | 3eaffcecf0a4b8191cddf80ef00c853e |
|
BLAKE2b-256 | 4fb458c6dfc7b013bfb9034a3319413bb54099ac90f9b1533e560e5adc164e94 |
Close
Hashes for pyndeval-0.0.3-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e4702110642a2b90151c53156a86c526decf366077b2a2aaae96f599a6a9732 |
|
MD5 | 7b0770513bcb02083feeae1c4ea7c624 |
|
BLAKE2b-256 | 6158cad9921d8fa5f6f050d32c1ab63e5474a05b0560c1efd635661c423c61dc |
Close
Hashes for pyndeval-0.0.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7033ce762353cc05203720f6b3cfbab5cce132a45714aa68d7169a4105617235 |
|
MD5 | 5712dd244c309afc459963aa53d26b7b |
|
BLAKE2b-256 | 41b378653586b9b990af775a6ce86c4fba75f90a7ea304c60710155aaa67b849 |
Close
Hashes for pyndeval-0.0.3-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 17b9fc01c82f84f02deba43f7ca1aab7dcd12e8a024325518366aba0d49df601 |
|
MD5 | 25de6a841df8d15e0d31437d3d8e22b8 |
|
BLAKE2b-256 | ed068d4456f1c4cc037c490267526d4edf3ecdfa23f5c2a5d88a2cd598d2fa8c |
Close
Hashes for pyndeval-0.0.3-cp311-cp311-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d3b053efb692db1254e77a6f5cba268c685c252b06d2f74a39fde429cd2fb37d |
|
MD5 | 016f622fde6a06233afeec870d36ab46 |
|
BLAKE2b-256 | db2b7f609e75d39051be928467dc3e25e3f7972dc0ccdaf6a59e477091033bb6 |
Close
Hashes for pyndeval-0.0.3-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e3495d059bff06ae77c15449bf9fdbe789b7ecfd29f775831f99124b4b18b5c |
|
MD5 | 055977279b932073c718b13a1c55bc67 |
|
BLAKE2b-256 | e3b48e670fb2ed53dfd125288c26d7655c5fb109618967db7b960e84c35a119a |
Close
Hashes for pyndeval-0.0.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ad877b2d004d78accfb0fb19df47b7899c89b694806d1bd8a992124ca42650c |
|
MD5 | 3556114dff5baae78f2e590de0c9095a |
|
BLAKE2b-256 | 87af81e8ff8bf2fd3e66e2c81274639d9215bc08b8d860f36941e6e428d8d2c2 |
Close
Hashes for pyndeval-0.0.3-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f9929566cf980fd1dc011959b4667e41ffd52754a1522b58dbbb2966b5fd5d3 |
|
MD5 | 2791b7da7525c744594180952920db8a |
|
BLAKE2b-256 | 87d06b226ddf4b630b2861e0960c0d211c67e552e93565e578faea3326207ac3 |
Close
Hashes for pyndeval-0.0.3-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 21f5cba4de6891f6aa1df181134e5ad2b704941795d0ea13c12b0215b3f2b251 |
|
MD5 | ca5f6fbdbc7bd393c307cfda70c1076b |
|
BLAKE2b-256 | b43a9c912a41c441198c714f06aa1eff14a8ac61079ac7f7710ecf0ca782c447 |
Close
Hashes for pyndeval-0.0.3-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e4650f27e61d790b2f26d02f2ada14c7fa2153f7a3dd10588398ea6655a2e87 |
|
MD5 | 4a87932fc22862b8e2a938c9bf9d7b63 |
|
BLAKE2b-256 | 6f2239f32ec3e06058e47b0afabf116d7db4eabc85bb04a49df11560b7d4694c |
Close
Hashes for pyndeval-0.0.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4b04584e62f383cc702901488de2320ae967de0fb7566ea94e5668cc6291379 |
|
MD5 | 2cff081b566a73800ffe4c0eed2aae15 |
|
BLAKE2b-256 | 42d165ef9c60ad39f5139ed987675bd101b62c7338662f9b3e4ed347844a8232 |
Close
Hashes for pyndeval-0.0.3-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b87b5f0c7bc5768097ed6aab68d16bbc68d3d0dd437f3b6664a81ed3a385678 |
|
MD5 | 87bd194c17c992b1370c2de5ec89b52e |
|
BLAKE2b-256 | ebebbddc9c33ed886b50ccba7b19dd72b5ac3a030406e146438aa19bc603a38a |
Close
Hashes for pyndeval-0.0.3-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f594c6850ef178df78a6f97c8a6d705fb4e5f308a1206509451b8db21f9a057c |
|
MD5 | 5aae2e803d156e32dca35cca0a0679d0 |
|
BLAKE2b-256 | 7cd321530f7c68562c419face99e01d76bfc2acd0f4ec7dd6603e92bfa0a013d |
Close
Hashes for pyndeval-0.0.3-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aef90fa8b5ad9c61815a06386348087412e53e6f81a948fea3e848ee827e99f0 |
|
MD5 | 937ea958f44441f139376f2228f04900 |
|
BLAKE2b-256 | 351ee228b6c0fa49b79784a963df724733e5d99682c564577d4da7f70adbe7e5 |
Close
Hashes for pyndeval-0.0.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1f1b6a8a1cdb87ae5a17f2866127417fba9ee8bc7097a008d0d561d3fa1a9c1 |
|
MD5 | 05375509a81544a15bd8b0b2091814ef |
|
BLAKE2b-256 | b8ef8baf72d524364cb976e5d6b2f25cedc319cbe623a23b6caa45e23a92cf1a |
Close
Hashes for pyndeval-0.0.3-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a215280908a91ee0d5fb0eb502496dfccd761e47f7a5bef5f8e16598e57aa3ac |
|
MD5 | 046966a357149320376e26944ba7f1e9 |
|
BLAKE2b-256 | 6c8baa662effebe90ad42b11d7a36457795d6774cc53d25361b391bc5c2c038f |
Close
Hashes for pyndeval-0.0.3-cp38-cp38-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e11951150b9b95440d28de1c8b2d0e1c59b4ed0a9b8da93ae9f17504f43c2444 |
|
MD5 | a9e30ccbfe3e8d7aa27828e70fdfd6a5 |
|
BLAKE2b-256 | b6e0eb2b5a6f9b3ca6031fc14f8f16e58c900ea0b206c8e9775bf2027440efbd |
Close
Hashes for pyndeval-0.0.3-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 648ae9c7a7325cef77babf865d74f8053ba03bb9f7212fc53d5b25253a3abd55 |
|
MD5 | 5e0a099302a2c79951eda68976bdf2ad |
|
BLAKE2b-256 | 016ab900ad173de96b250c8e0f896f54c9e592b1b2649eecac55062c766c05ca |
Close
Hashes for pyndeval-0.0.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8246d53d18e76613cb56953bf5cb239177bae991f6ed8730f6e2bca9fa4554de |
|
MD5 | 389f7265deb1db9933d9e1b880c784dd |
|
BLAKE2b-256 | 3688902c04ab796daa44fe76224850f1bca7b3ed6b6dc3d40d3c78fcac580d9a |
Close
Hashes for pyndeval-0.0.3-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d9e0371b963ea5b77117c89d01b4c4e94a70130a5f54a9b8f661669937133eea |
|
MD5 | 105ca383be2c308e2d4698e97ce7a04a |
|
BLAKE2b-256 | c1b06a46427b26a48e3ccb67ccfe6874e87e66b53cdd345bd9638f6b6adf2346 |
Close
Hashes for pyndeval-0.0.3-cp37-cp37m-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2cff79a6c5e0486f4db7f72a781fe75dd3bb9d3fba321e358f6e290d9adf7ffb |
|
MD5 | ebeacd8f9a7f7ba3d90821639bebe969 |
|
BLAKE2b-256 | 3a0c5dc178ff1522889e4a095ef5a56e8a07ccf40c64c629fa7872e73b29a258 |
Close
Hashes for pyndeval-0.0.3-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5fff79f0bbcc805f931461df0f6825b3652df2ce2e571dfad09975bcc3284b2a |
|
MD5 | 7f26348945d68d6155579cc49dfb24a6 |
|
BLAKE2b-256 | 2f65f74e91cec9685c490660a3ae386fd0c3ab42b5f6c0a6dbb7a3fbb0d19680 |
Close
Hashes for pyndeval-0.0.3-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ad3f4afe9eef193024604bc720bd9337a2067fa21e4d62e102730247cf40ac5 |
|
MD5 | b9b179ac0a800b906e9cfde9b051fef2 |
|
BLAKE2b-256 | ad02014aaae814eeb4c6d3272fbe14c598184545cd4fe6b59e3357aecd6913c1 |