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.4.tar.gz
(15.0 kB
view hashes)
Built Distributions
Close
Hashes for pyndeval-0.0.4-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 035f61003809c4eb6f570027c9a5fdeea51f389d1354837f174a9a008e76d725 |
|
MD5 | 9c6a18c364a30ab611187f238a00a3ee |
|
BLAKE2b-256 | 860e01e9741cafcbda2fff9da11cec61ed28828b18cf86c885afbabe69dc8ddc |
Close
Hashes for pyndeval-0.0.4-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 073642c780d5a4e686e8b1e06ec3fa3c0b9d2fb2d20334189a45501d71928631 |
|
MD5 | e6b60a7d0ba796b846119cc550488ddd |
|
BLAKE2b-256 | 1c0e39e9b5dece58b994037a6059c4203a80160a601545df1f10250314e80a9d |
Close
Hashes for pyndeval-0.0.4-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4e19777e40b75c2d5b13ed33020ceb622f838473ae77f10b92693408e5ecbb6 |
|
MD5 | b7c71f551c32c2a5086300567bfeba72 |
|
BLAKE2b-256 | 89d79bbbd55cd2b6df5de31c204acad5c0b4f0a533f74ba0fca4b98c27daf21d |
Close
Hashes for pyndeval-0.0.4-pp38-pypy38_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 06ff79cb955669336315f6a4f796ab97a4d04c16e09128682a1c71a3c25d9947 |
|
MD5 | 10f96bc70340be8b10daf13b31df4a4a |
|
BLAKE2b-256 | 0116a00b3ee6553c77f666b8bc42c8b5a6a4144d5d33f2e0025f9588a2f50c53 |
Close
Hashes for pyndeval-0.0.4-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f52ef3b230d387b5029b53a91dc378a84f44a04da23047bcc435a9a8426d599 |
|
MD5 | bd7757f92aea34344150e11573013ef2 |
|
BLAKE2b-256 | 2d8665be017a6490ec7a573dac9b191a7bf37269ea57557173fe7e5486083455 |
Close
Hashes for pyndeval-0.0.4-pp37-pypy37_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6281b4706c796ba7933c578372b19b42ba8de887b155c5fe2446a1dc424413cf |
|
MD5 | ec3bcd8abe10f6cd5e0cb6ab2ca92a91 |
|
BLAKE2b-256 | 743da46a9d66be4cdfaeb7cae78b7b58347683f33c7f992769e7ba1a5316ee93 |
Close
Hashes for pyndeval-0.0.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e8dbe07ef39d2587a52b8c6f80d50f4264a76d82e6680df3464305c9a897490e |
|
MD5 | b0b826fa119ebb537a7b833941229fb8 |
|
BLAKE2b-256 | f2c20363064c1537a93cd263267e91eef660205563549fb909ee743a1b237c25 |
Close
Hashes for pyndeval-0.0.4-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1100d49054beeb5ed7decce07e2c9a3853330c2bd1c2cffdb56a3594b10d75ea |
|
MD5 | 8866b3c2b23eea48de571e1e0097819d |
|
BLAKE2b-256 | 417538a7f23c4f0546f21135e6eb3556c517012b946c1de83e8148ee14e68653 |
Close
Hashes for pyndeval-0.0.4-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 528c94459a5a8fa607046c7fc88cc74bd5e0a5f57be4f9ea61533c1a5f5cda67 |
|
MD5 | 36a06558512a3a91fcb0f817299e3c96 |
|
BLAKE2b-256 | f4b22a424e0060958b6a4dfa8059a83ecb7ab73f5ab061322072e0d951858e7a |
Close
Hashes for pyndeval-0.0.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 324bda28b9c313d7775b803f9830fbdaf7e5db68a81be83007b4096c21615a17 |
|
MD5 | 40a1bbeeebc8abdee845932b55d2c44f |
|
BLAKE2b-256 | 15de6431b0a56bd98004121e30d827ee99dfc9521237af99f0f19e391e322731 |
Close
Hashes for pyndeval-0.0.4-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6198b137acc4e63274aaebbb7af29051f3705c13dfe46923572e67e666cb6e67 |
|
MD5 | 193019c364091168b7838a3676945140 |
|
BLAKE2b-256 | b98cf2c21fe0146c7b6d886ca300968e4e4f1e60217b7a085bd6dac09ba02bcc |
Close
Hashes for pyndeval-0.0.4-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4488c8de9b032c93bc8e78f56471f741231ca08564c0e1f70ed72470bb0395f |
|
MD5 | 14d678683f3d6252b0beae0eda536484 |
|
BLAKE2b-256 | 19342791439b5c9719cb377f5df18d9280e14f15abc6e326bd8b4afa1bb8ddbd |
Close
Hashes for pyndeval-0.0.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 63f85d7b7daa5e3c3c19104755aa70a51c1ce5eda75bcd152cb13553676b1aa7 |
|
MD5 | d4abfb0e00614016c2957389cc7d8bfc |
|
BLAKE2b-256 | 77b63ae34a5fe878b02887b56bc8426941552c62f0c755423b540fd458ac76bd |
Close
Hashes for pyndeval-0.0.4-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f85378b005efb96f0b3373d0611a8f4a26c37fce734ca8d4757b9da202e34e0b |
|
MD5 | 6a496f2e0601b6645f69635fc50627fc |
|
BLAKE2b-256 | 1d1554373203b0b020599feb633b466c2a321891037bb9fc0f2ed53b71c53143 |
Close
Hashes for pyndeval-0.0.4-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 32f6ac2e1cd87e8bd607fdd5e69ae6cc9d651801163cf26575608a3712233842 |
|
MD5 | 0061fe734bc91ddf2b51fde397343d5c |
|
BLAKE2b-256 | aa9622ee18b2a0de930b250bea2f14d2d34e7ed8c8d078318725bf628055b065 |
Close
Hashes for pyndeval-0.0.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 02bd4cd8d22017fe52e7fcaa77f617c3b58679a0b952a5d5b22f2e1abd3c84a5 |
|
MD5 | 1f45ebb8eefd0864f2c4aa08f146a700 |
|
BLAKE2b-256 | d42caa7a3836116e6e2ff54e16a6ef0f8e523b567efb69fe0aeaefb6bcf4add2 |
Close
Hashes for pyndeval-0.0.4-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 615aeee8c94fc5e1e298c4bca2ac008f179321432e01f2705b8a164b76bedad2 |
|
MD5 | bc9e9cca73845f55b0dea888ada7b508 |
|
BLAKE2b-256 | cf28e5432ea5a0a66bb6670e7937ebabaa1a22c9c23ba827e1aee254efae6718 |
Close
Hashes for pyndeval-0.0.4-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 32bc175d02372e812b2baabddec2db19e39e4b574b7b2cc4c28e36cf771e25d3 |
|
MD5 | a14703a7cf2c591deccc6d151b3534be |
|
BLAKE2b-256 | 174bcd4f9bf502f557f145152c94c1f47da22df13b59f177b34a781e925857bd |
Close
Hashes for pyndeval-0.0.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 826d310cfe3427777543f45af42caf06e28576c8fd85e3d3d0ccc5bcb1b32b62 |
|
MD5 | e9cffeaa30d970c01c6805cada51d197 |
|
BLAKE2b-256 | 70975f1605c828687841600e3d1300f19eeb14d59aec0cf0a085b45a3724c696 |
Close
Hashes for pyndeval-0.0.4-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e9cc51d3ca7e1a6791b9af87eeeb24c9ab9f1af1c359d79c9108fe4682b64d79 |
|
MD5 | 916fce16fa2b61d12f230662f8c5a6a6 |
|
BLAKE2b-256 | 02812b6254672d3e1ccb595101b5fc233843e3b24507072de69f5b0a3ab013dc |
Close
Hashes for pyndeval-0.0.4-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7821ef823df20dcc018edef2fa6c733bae263f46861bab58e92971d59e641788 |
|
MD5 | 333cc42f4d0c8c13004334256d99d95b |
|
BLAKE2b-256 | af3780deece98b7670f23a8e22aa3f44c4bcf2719e87b2b0c1d3014efe6724fd |
Close
Hashes for pyndeval-0.0.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e42290602f354dc8c595f02c819df45007d3d0aaea97e698c3623233e1b1dcbf |
|
MD5 | 99c47aaa8b7a94157a52ec7943bff473 |
|
BLAKE2b-256 | 59b8d6beb63c24fa915810a1b67899f25e6a01e262f50c904a8b457a7cb4db02 |
Close
Hashes for pyndeval-0.0.4-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a212884f25af89ef95e18b862b3b2d530a71eea733d2a954d79323c6d12ce9aa |
|
MD5 | 3bb0154afe8bfe136bac72d93545901a |
|
BLAKE2b-256 | a2e93f1c6ba86480c68c527d5358b42a684e94cf698d0cc19e84cf2649e015b2 |
Close
Hashes for pyndeval-0.0.4-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | de837a0ebdae77ae3ca1fc969c869e16e1f0c2ab0b938883304ecf2d9d2c3489 |
|
MD5 | ad48a51d4391945b6bf71b0dd1fc52e1 |
|
BLAKE2b-256 | 5ed0cf0433057443a6fe371df570f6a05e504f4e079268887c74ff4e5da76fac |
Close
Hashes for pyndeval-0.0.4-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3865a81eac2a55ad3ecf91db7665d7b58ed81712655e6234757fc8dd937499eb |
|
MD5 | 092b1743ceef9437cec3c5bd18de343c |
|
BLAKE2b-256 | b823747870ace3ecfb1c7082b7736417e754c99bf1b59e56c6667fa014a1fd13 |
Close
Hashes for pyndeval-0.0.4-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ef10762d62f1ffa61b2962dde2a65505c548ffd9125bc28b277027a119f3d92 |
|
MD5 | 346617064f713b303d2bfb44adfd13f9 |
|
BLAKE2b-256 | e0e977de23331ce0714cd0b080ac255c2f12db85e06f373a9a377dee800c2938 |
Close
Hashes for pyndeval-0.0.4-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 01cd08b19dc8b44230bdfb61280988ddd0a7d4467f0d92e31054c7edb2e088f9 |
|
MD5 | 07cb1f53c4c92e010a68ef0ffacd904e |
|
BLAKE2b-256 | 583fe88f30644ea24b780cbfce0ca609606a77ac2486ef4f2273ea8a96053414 |