Package: cwl-eval
C/W/L Evaluation ScriptAn evaluation script based on the C/W/L framework
that is TREC Compatible and provides a replacement
for INST_EVAL, RBP_EVAL, TBG_EVAL, UMeasure, TREC_EVAL.InstallInstall either viapip install cwl-evalorgit clone https://github.com/ireval/cwl.git.cwl-evalrequires Python 3 and Numpy.UsageOnce you have installed the C/W/L Evaluation Framework usingpip install, you should be able to use thecwl-evalas shown below.
If you have usedgit cloneto install the framework, then you will need to runcwl_eval.pydirectly.Usage: cwl-eval <gain_file> <result_file> -c <cost_file> -m <metrics_file> -b <bibtex_file>

Usage: cwl-eval <gain_file> <result_file> -c <cost_file> -m <metrics_file>

Usage: cwl-eval <gain_file> <result_file>

Usage: cwl-eval -h<gain_file>   : A TREC Formatted Qrel File with relevance scores used as gains (float)
Four column tab/space sep file with fields: topic_id unused doc_id gain<cost_file>   : Costs associated with element type<cost_file>   : If not specified, costs default to one for all elements
Two column tab/space sep file with fields: element_type element_cost<result_file> : A TREC Formatted Result File
Six column tab/space sep file with fields: topic_id element_type doc_id rank score run_id<metrics_file>: The list of metrics that are to be reported
If not specified, a set of default metrics will be reported
Tab/space sep file with fields: metric_name params<bibtex_file>: Specify this file if you would like the BibTeX associated with the measures specified to be
output to a file called <bibtex_file>-n: Add -n flag to output column names (e.g. Topic, Metric, EU, ETU, EC, ETC, ED)-r: Add -r flag to also output residuals for each measurement.--max_n : Specify the depth of the calculation of the metrics (default=1000).--max_gain : Specify the maximum value of the gain (default=1.0). Note some metrics have restrictions on the maximum allowable value. This is also used when computing the residuals.--min_gain : Specify the minimum value of the gain (default=0.0). Note some metrics have restrictions on the minimum allowable value.Example without using a cost fileWhen no costs are specified the cost per item is assumed to be 1.0, and EC and I will be equal.cwl-eval qrel_file result_fileExample with using a cost filecwl-eval qrel_file result_file -c cost_fileOutputA seven column tab/space separated file that contains:Topic IDMetric NameExpected Utility Per Item (EU)Expected Utility (ETU)Expected Cost per Item (EC)Expected Cost (ETC)Expected Depth (ED)If the-rflag is included, then another five columns will be included: ResEU, ResETU, ResEC, ResETC, ResED.
These report the residual values for each of the measures (i.e. the difference between the best case and worse case for un-judged items).CWL CitationPlease consider citing the following paper when using our code for your evaluations:@inproceedings{azzopardi2019cwl,
        author = {Azzopardi, Leif and Thomas, Paul and Moffat, Alistair},
        title = {cwl\_eval: An Evaluation Tool for Information Retrieval},
        booktitle = {Proc. of the 42nd International ACM SIGIR Conference},
        series = {SIGIR '19},
        year = {2019}
    }Metrics within CWL EVALFor each of the metrics provided in cwl_eval.py, the user model for each
measure has been extracted and encoded within the C/W/L framework.All weightings have been converted to probabilities.As a result, all metrics report a series of values (not a single value):Expected Utility per item examined (EU),Expected Total Utility (ETU),Expected Cost per item examined (EC),Expected Total Cost (ETC)Expected number of items to be examined i.e expected depth (ED)All the values are related, such that:ETU = EU * EDandETC = EC * EDIf the cost per item is 1.0, then the expected cost per item is 1.0,
and the expected cost EC will be equal to I.Costs can be specified in whatever unit is desired. i.e seconds, characters, words, etc.List of MetricsRR - (Expected) Reciprocal RankP@k - Precision At kAP - Average PrecisionRBP - Rank Biased PrecisionINST TINSQ TNDCG@k - Normalized Discounted Cumulative Gain at kBPM-Static - Bejewelled Player Model  - StaticBPM-Dynamic - Bejewelled Player Model - DynamicUMeasure - U-MeasureTBG - Time Biased GainIFT-C1 - Information Foraging Theory (Goal)IFT-C2 - Information Foraging Theory (Rate)IFT-C1-C2 - Information Foraging Theory (Goal and Rate)NERREq8 - Not/Nearly ERR(Eq8)@k using gain based stopping with truncation kNERREq9 - Not/Nearly ERR(Eq9)@k using gain based stopping and discount with truncation kNERREq10 - Not/Nearly ERR(Eq10)@phi using gain based stopping and RBP patience (phi)NERREq11 - Not/Nearly ERR(Eq11)@T using gain based stopping and INST Goal (T)Sample Output from cwl_eval.py where costs per item = 1.0cwl-eval qrel_file result_fileTopicMetricEUETUECETCEDT1P@200.1503.0001.00020.00020.000T1P@100.3003.0001.00010.00010.000T1P@50.3601.8001.0005.0005.000T1P@11.0001.0001.0001.0001.000T1RBP@0.50.5661.1321.0002.0002.000T1RBP@0.90.2142.1361.00010.00010.000T1SDCG-k@100.3801.7261.0004.5444.544T1SDCG-k@50.4611.3581.0002.9482.948T1RR1.0001.0001.0001.0001.000T1AP0.3971.9071.0004.8004.800T1INST-T=20.4011.3031.0003.2423.247T1INST-T=10.6801.0711.0001.5741.575T1INSQ-T=20.3161.4281.0004.5094.525T1INSQ-T=10.4651.1981.0002.5722.576T1BPM-Static-T=1-K=10001.0001.0001.0001.0001.000T1BPM-Static-T=1000-K=100.3003.0001.00010.00010.000T1BPM-Static-T=1.2-K=100.4001.2001.0003.0003.000T1BPM-Dynamic-T=1-K=1000-hb=1.0-hc=1.01.0001.0001.0001.0001.000T1BPM-Dynamic-T=1000-K=10-hb=1.0-hc=1.00.3003.0001.00010.00010.000T1BPM-Dynamic-T=1.2-K=10-hb=1.0-hc=1.00.4001.2001.0003.0003.000T1U-L@500.1092.7721.00025.50025.500T1U-L@100.3381.8601.0005.5005.500T1TBG-H@220.0832.6761.00032.24232.242T1IFT-C1-T@2.0-b1@0.9-R1@10.4561.3231.0002.9032.903T1IFT-C1-T@2.0-b1@0.9-R1@100.3082.0781.0006.7386.738T1IFT-C1-T@2.0-b1@0.9-R1@1000.2892.2241.0007.6987.698T1IFT-C2-A@0.2-b2@0.9-R2@10.4631.2551.0002.7112.711T1IFT-C2-A@0.2-b2@0.9-R2@100.2932.0401.0006.9656.965T1IFT-C2-A@0.2-b2@0.9-R2@1000.1972.9941.00015.20815.208T1IFT-C1-C2-T@2.0-b1@0.9-R1@10-A@2.0-b2@0.9-R2@100.3291.8041.0005.4875.487T1IFT-C1-C2-T@2.0-b1@0.9-R1@100-A@2.0-b2@0.9-R2@1000.2892.2231.0007.6977.697Sample Output from cwl-eval where costs are set based on cost_filecwl-eval qrel_file result_file -c cost_fileTopicMetricEUETUECETCEDT1P@200.1503.0001.65033.00020.000T1P@100.3003.0002.30023.00010.000T1P@50.3601.8002.40012.0005.000T1P@11.0001.0002.0002.0001.000T1RBP@0.50.5661.1321.9513.9022.000T1RBP@0.90.2142.1361.77617.76510.000T1SDCG-k@100.3801.7262.1889.9434.544T1SDCG-k@50.4611.3582.2246.5572.948T1RR1.0001.0002.0002.0001.000T1AP0.3971.9071.9589.4004.800T1INST-T=20.4011.3031.8846.1133.247T1INST-T=10.6801.0711.9553.0771.575T1INSQ-T=20.3161.4281.7998.1254.525T1INSQ-T=10.4651.1981.8874.8552.576T1BPM-Static-T=1-K=10001.0001.0002.0002.0001.000T1BPM-Static-T=1000-K=100.3601.8002.40012.0005.000T1BPM-Static-T=1.2-K=100.4001.2001.6675.0003.000T1BPM-Dynamic-T=1-K=1000-hb=1.0-hc=1.01.0001.0002.0002.0001.000T1BPM-Dynamic-T=1000-K=10-hb=1.0-hc=1.00.3601.8002.40012.0005.000T1BPM-Dynamic-T=1.2-K=10-hb=1.0-hc=1.00.4001.2001.6675.0003.000T1U-L@500.1622.5521.65426.00015.720T1U-L@100.4441.4202.0946.7003.200T1TBG-H@220.1432.3392.04633.50816.375T1IFT-C1-T@2.0-b1@0.9-R1@10.4561.3231.9715.7232.903T1IFT-C1-T@2.0-b1@0.9-R1@100.3082.0782.08014.0176.738T1IFT-C1-T@2.0-b1@0.9-R1@1000.2892.2242.06815.9227.698T1IFT-C2-A@0.2-b2@0.9-R2@10.5161.1801.9584.4812.289T1IFT-C2-A@0.2-b2@0.9-R2@100.4041.3682.0116.8023.382T1IFT-C2-A@0.2-b2@0.9-R2@1000.3601.7862.38811.8324.954T1IFT-C1-C2-T@2.0-b1@0.9-R1@10-A@2.0-b2@0.9-R2@100.4131.3611.9906.5523.293T1IFT-C1-C2-T@2.0-b1@0.9-R1@100-A@2.0-b2@0.9-R2@1000.3601.7862.38811.8324.954Using the metrics_file to specify the metricscwl-eval qrel_file result_file -m metrics_fileif a metrics_file is not specified, CWL Eval will default to a set of metrics
defined inruler/measures/cwl_ruler.pyIf the metrics_file is specified, CWL Eval will instantiate and use the metrics listed.
An example test_metrics_file is provided, which includes the following:PrecisionCWLMetric(k=1)
PrecisionCWLMetric(k=5)
PrecisionCWLMetric(k=10)
PrecisionCWLMetric(k=20)
RBPCWLMetric(theta=0.9)
NDCGCWLMetric(k=10)
RRCWLMetric()
APCWLMetric()
INSTCWLMetric(T=1.0)
INSQCWLMetric(T=1.0)
BPMCWLMetric(T=1.0,K=20)
BPMCWLMetric(T=2.0,K=10)
BPMDCWLMetric(T=1,20)
BPMDCWLMetric(T=2.0,K=10)
UMeasureCWLMetric(L=50)
UMeasureCWLMetric(L=10)
TBGCWLMetric(halflife=22)
IFTGoalCWLMetric(T=2.0, b1=0.9, R1=10)
IFTGoalCWLMetric(T=2.0, b1=0.9, R1=100)
IFTRateCWLMetric(A=0.2, b2=0.9, R2=10)
IFTRateCWLMetric(A=0.2, b2=0.9, R2=100)
IFTGoalRateCWLMetric(T=2.0, b1=0.9, R1=10, A=0.2, b2=0.9, R2=10)
IFTGoalRateCWLMetric(T=2.0, b1=0.9, R1=100, A=0.2, b2=0.9, R2=100)
NERReq8CWLMetric(k=10)
NERReq9CWLMetric(k=10)
NERReq10CWLMetric(phi=0.8)
NERReq11CWLMetric(T=2.0)To specify which metric you desire, inspect the metrics classes inruler/measures/to see what metrics are available, and how the parameterize them.For example if you only wanted Precision Based Measures then you can list them as follows:PrecisionCWLMetric(1)
PrecisionCWLMetric(2)
PrecisionCWLMetric(3)
PrecisionCWLMetric(4)
PrecisionCWLMetric(5)
PrecisionCWLMetric(6)
PrecisionCWLMetric(7)
PrecisionCWLMetric(8)
PrecisionCWLMetric(9)
PrecisionCWLMetric(10)
PrecisionCWLMetric(11)
PrecisionCWLMetric(12)
PrecisionCWLMetric(13)
PrecisionCWLMetric(14)
PrecisionCWLMetric(15)
PrecisionCWLMetric(16)
PrecisionCWLMetric(17)
PrecisionCWLMetric(18)
PrecisionCWLMetric(19)
PrecisionCWLMetric(20)While if you only wanted Rank Biased Precision Measures, then you can vary the patience parameter:RBPCWLMetric(0.1)
RBPCWLMetric(0.2)
RBPCWLMetric(0.3)
RBPCWLMetric(0.4)
RBPCWLMetric(0.5)
RBPCWLMetric(0.6)
RBPCWLMetric(0.7)
RBPCWLMetric(0.8)
RBPCWLMetric(0.9)
RBPCWLMetric(0.95)
RBPCWLMetric(0.99)