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.5.tar.gz
(15.0 kB
view hashes)
Built Distributions
Close
Hashes for pyndeval-0.0.5-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b7123958b56bb1c5104a6006bba0fdb033d477b8aa8304ee89842ceb87c58c3a |
|
MD5 | 23f03f0482bf6fbb89b0ce97ed6a4bf0 |
|
BLAKE2b-256 | 3c901bcfc2b9a4690ae330b843a8026b9161ed2b3f86b7b48f4b40c063484820 |
Close
Hashes for pyndeval-0.0.5-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50ca71470b3e88403767850a6f26634f03a71ab091143ea19894184eec46daf5 |
|
MD5 | 3ed1d215a5390daa35373b184355e583 |
|
BLAKE2b-256 | c01603fd935847818834400782ed716e35c5639694da7ede7b8507fe31f977de |
Close
Hashes for pyndeval-0.0.5-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 72d948074452eb8c34cc2fc2569a6756d2165b91fa1dee04ad8d5b6ce189fd40 |
|
MD5 | 0aa6f14ac5186cca803818eacad41a5b |
|
BLAKE2b-256 | af09e537c7d3618b9b474aa09db66fb881b11f99281ecee29e3502e2e45171a4 |
Close
Hashes for pyndeval-0.0.5-pp38-pypy38_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 402f4ef5a158ee1e0eeb83196dfa40b96aacc35a9c443e03e587f028c61307d9 |
|
MD5 | d285d458ba4b252d2336c213a17d4af2 |
|
BLAKE2b-256 | 28ecd902938d37bc8bc6c941628ca2f4923a2ca41f867629d1bd9c1bef3480ef |
Close
Hashes for pyndeval-0.0.5-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c5cbd4878ddfa9f7cbc1cbad347f4ebf5c54a83cf4741f214f12c0873c4ee26 |
|
MD5 | 6fde56466f36d84dd6f1af8e537ee15e |
|
BLAKE2b-256 | 121c2bd439f96f0e7696b82ccdadf5b02c66397fa34e27c226c239cf7431f9c3 |
Close
Hashes for pyndeval-0.0.5-pp37-pypy37_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6fae5c0bd3a8384e2a9fa4551c6c645b8d819c36680617071ae9909601fa5872 |
|
MD5 | 5ca2d99146f615c581f04bcedaf703ba |
|
BLAKE2b-256 | 25dc7a7d2b0b36a14407d6a581911ad0e377863151d642534e0fb6af5fd2155d |
Close
Hashes for pyndeval-0.0.5-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03db3e3cfb6686c74643c60c17ed45b1388085c537ae8195538aa02c36396ef0 |
|
MD5 | 85e64fb4de366f43153336621ab9a4d9 |
|
BLAKE2b-256 | 97a9cc50ef6d7c6c094b2d4ea25b10b2b757408414ac4efaa6baf4400f6f2155 |
Close
Hashes for pyndeval-0.0.5-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 36d14bfb4fc1550883cbe6feac4bfadcaa710c6e3fb0f799553e529a36fb72f8 |
|
MD5 | 6d5c02fb2e9cd32d4043bf92dae0e4c4 |
|
BLAKE2b-256 | 2b3e370069abad3bb3295a2bdd827f3db64ea5d85a027fa820a16543ab9be588 |
Close
Hashes for pyndeval-0.0.5-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82139de6cc5a9845c134ed714edfadadeb6fed97416da18636e915f09b90677a |
|
MD5 | 03f6a441d856847132f9cb48b5d5e893 |
|
BLAKE2b-256 | e386e150fde45db1a900b488a09fc27e4d03f65109f0edcac17ea77e613c39f5 |
Close
Hashes for pyndeval-0.0.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe8853fe351e085b95d7e8a26be55c1ba78ef0bcf5e9cdae0dac5895b92918f1 |
|
MD5 | e0649b340900da82fe409f5842f13a30 |
|
BLAKE2b-256 | bdf674574a8dbbc941d2e191eb2bdfdea3003ef535a18d8274f21ac2b0ab81af |
Close
Hashes for pyndeval-0.0.5-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8dc07e3cac2fb9f3fbaf84f2802dd0804b03389ee12d5fccd5a7088beec66cb1 |
|
MD5 | 053a5fd9a32d16f7282c7e492a9fd038 |
|
BLAKE2b-256 | cca2dea414cf4d347b3b196c15df8352cf6721e19ae76c0c46e6ea1c7ae1fb81 |
Close
Hashes for pyndeval-0.0.5-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 72b4b2a214674247bbe35081386770b7bdfd3c574dbc11949d11f4de6f5ed582 |
|
MD5 | 450ab1af45c2e9e763a0e4c03946cc3c |
|
BLAKE2b-256 | 20eb3b9d92f84d6ba0737822e31d0536a72c6479bfcdd902dd7145a5870b2ad1 |
Close
Hashes for pyndeval-0.0.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 19ceef1cef62eddd9e8f56b765444dfb308dacd16dac6f5b79c5eedcaa892d2b |
|
MD5 | 54a20b371774dc96976d55d5d70e360a |
|
BLAKE2b-256 | d788d741db9e6c75c08f506559bd6f94c2cd448dd1b82992422631175d0e3441 |
Close
Hashes for pyndeval-0.0.5-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62725653d8465be1d88c9146d4ceee0719865ca940bddd3420c056968dbc4021 |
|
MD5 | 4239e6af29d081cb485a9d0396d0b4c8 |
|
BLAKE2b-256 | c40c224ad34b2bf8406968ce146d0bc898e1e946c254922eb36b713fd0b829e1 |
Close
Hashes for pyndeval-0.0.5-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec0c1bddd14826e8124cfeda3e66f7c7fec8ad15cffa8eb297846a5741382789 |
|
MD5 | 7ccb9f9f7835c5a9a3c516f3b2e09ff3 |
|
BLAKE2b-256 | 56dd89578173dee98f673579e4d21f435247b5bcb83b93b281e68183b5f7c773 |
Close
Hashes for pyndeval-0.0.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba79871853f13dd8bc1e26436a8c0ad958b311a76923fe7a87821a875ced6029 |
|
MD5 | 44255a0501335d2efcd808aa87addacb |
|
BLAKE2b-256 | 7aefbabaae14b4e39b08c8646c12ff22df2c07c0cae44167175902ac0345e07c |
Close
Hashes for pyndeval-0.0.5-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c9fe23248705185b98523b6a9eac529f785cc7857f5f81ab5ad45cca2dadfb5 |
|
MD5 | 19184da81326df38a1f06b09d455d7d4 |
|
BLAKE2b-256 | 45514cb236e40209b414ce5b220f255e60ff1a67028bacf6b62d2e83bce320ad |
Close
Hashes for pyndeval-0.0.5-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41c1f9ec475aa113cce01be5d0800ff2dc17caec61f186647f0c1e2ca940761c |
|
MD5 | 2439584ca2231b2116a8f275b58a3087 |
|
BLAKE2b-256 | 2965a6c5f8889903dc3e9dcd5ffd8e9f07afea71b9d3ec54ddf6ed522631965b |
Close
Hashes for pyndeval-0.0.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf833c1a08953638f97126a00e39ad11b9800cc367692e3631605d3b16609c5c |
|
MD5 | a283b7a006afb919c2dba24369533eee |
|
BLAKE2b-256 | e2caa87b632e167e68afd4aec89e6df55c5851a867977f90d934c7ab5e7324ee |
Close
Hashes for pyndeval-0.0.5-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1564a683159ca09951471a9a227dee78eac8587ba8158da5a9ef57f75ff829fe |
|
MD5 | 81013d5e3197bbf2c6785eafba96542b |
|
BLAKE2b-256 | 4e916f5eb504ea191c767509f60015b127859330b9ecde04cd47a2b4fbe39cb6 |
Close
Hashes for pyndeval-0.0.5-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88187e70f971810ab7400c83af68a1b838e5980942cfb6e29ef3f1ed9d7df26a |
|
MD5 | a83ee0af48e19e66db41e6b3f1eae294 |
|
BLAKE2b-256 | 244cba97730708e4e7da453db78b7a56c8a6d33876bb6bf7f84b437216b5f6aa |
Close
Hashes for pyndeval-0.0.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e9146513251562cf54774e84514268221c49445959b21a1def5e3e87c332302 |
|
MD5 | 1e4e9696c2f518d3a3fc61e3f1f5ae75 |
|
BLAKE2b-256 | 2c3b0ecd6536011a82c520415f43fe78af8ccef6c696e1a775261d3f45b4569a |
Close
Hashes for pyndeval-0.0.5-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4b3f0cd785ebfe240f54a5a314f059f7a60765c913136839b17bb00776693a9 |
|
MD5 | 87bffbb6c0d83245e5308de7e86a06da |
|
BLAKE2b-256 | ae81274acaa86f12bd055010a9d16f2cd1c84b2b5be038efdb5b6ce491bbb5f9 |
Close
Hashes for pyndeval-0.0.5-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 785bf1fdbb34140ec98d33c7250fefe4cf9d04e39dad3b4f06769e592939584d |
|
MD5 | 33c15b936342a8f327f39f7dc505e534 |
|
BLAKE2b-256 | 079dbd16356ff42077b3ac431176f21880bd6941c8419685b3d6b844013022a1 |
Close
Hashes for pyndeval-0.0.5-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d2b16c7ce9042b35b84625f24428b6f4eb3f52551e44a2fedd6057fb9663440 |
|
MD5 | 21694e7113220022a80004b42b36fad3 |
|
BLAKE2b-256 | 9ab823789ebda17d1bf3e0d18018d11fbca5880dcb9145a85ed3d5b686f14bee |
Close
Hashes for pyndeval-0.0.5-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 605a09dce3d5769f3672ce9dba698eb1753e7203b9ec48e908380a2c2940fc2d |
|
MD5 | 017ea8d4c72e0dee00172e6368716661 |
|
BLAKE2b-256 | 3d9d839a58453f29fafa2d0579361e3221f0cb1deaaf251ea7471d9a53b9b282 |
Close
Hashes for pyndeval-0.0.5-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d647f57fbec1f7b5ff513aa06c6c5486b7602e2fa16cb96b7c015b5c010e345 |
|
MD5 | 668c8fa1ed2a2e9d1fe41d3d64a00abe |
|
BLAKE2b-256 | 17cce43b83f216acf1d9a335cf2a04309bfc92ef301dd9fd5bb711509c4b4e09 |