Skip to main content

License Documentation Status Worfklow PyPI version fury.io Code style: black

DiffIR

DiffIR is a tool for visually 'diffing' the difference between two sets of rankings. Given a pair of TREC runs containing rankings for multiple queries, DiffIR identifies contrasting queries that have "substantially" different results between the two systems and generates a visual side-by-side comparison illustrating how the key rankings differ.

DiffIR supports multiple query contrast meastures for ranking comparison including unsupervised ranking correlations like TauAP and supervised comparison based on existing judgments. DiffIR additionally accepts term importance weights in order to highlight the terms most relevant to a model's relevance prediction.

Usage Open In Colab

Installation

Python 3 is required. Install via PyPI:

pip install diffir

Usage

Download two run files to test with:

wget -c https://github.com/capreolus-ir/diffir/raw/master/trec-dl-2020/p_bm25
wget -c https://github.com/capreolus-ir/diffir/raw/master/trec-dl-2020/p_bm25rm3

Compare the two files and output a comparison page to bm25_bm25rm3.html:

diffir p_bm25 p_bm25rm3 -w --dataset msmarco-passage/trec-dl-2020 \
       --measure qrel --metric nDCG@5 --topk 3 > bm25_bm25rm3.html

Now open bm25_bm25rm3.html in your web browser. You should see DiffIR's web interface:

Command line arguments

Usage: diffir <run files> <options> where the run files are 1 or 2 positional arguments indicating the run files to visualize, and <options> are:

  • -w to output HTML or -c for the command line interface
  • --dataset <id>: a dataset id from ir_datasets
  • --measure <measure> the query contrast measure to use. Valid measures: qrel, tauap, pearsonrank, weightedtau, spearmanr, kldiv (using scores)
  • --metric <metric>: the relevance metric to use with the qrel measure. Accepts ir_measures notation
  • --topk <k>: the number of queries to compare (as identified by the query contrast measure)
  • --weights_1 <file>, --weights_2 <file>: term importance files to use for snippet selection

Batch mode

Use diffir-batch to generate comparison pages for every pair of run files in a directory.

Usage: diffir-batch <input directory> -o <output directory> <options> where the <options> are those shown above.

Metadata

Release files for diffir 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for diffir 0.2.0
File Size Uploaded Provenance Actions
diffir-0.2.0.tar.gz 26.9 kB Without provenance Details for diffir-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for diffir 0.2.0
File Interpreter ABI Platform Actions
diffir-0.2.0-py3-none-any.whl Python 3 none any Details for diffir-0.2.0-py3-none-any.whl

Total release size: 61.5 kB

Release files / diffir-0.2.0.tar.gz

Download URL diffir-0.2.0.tar.gz
Size 26.9 kB
Tags Source
SHA-256 checksum
How to use checksums
716777217ae254f05ad3f8d681bbad357056cc1f6ba6f86ab464670931dd389e
BLAKE2b-256 checksum
How to use checksums
1b8027ac89e30c0138602e8a3a31c4059bca8f7398fbf8734126592d96457dce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.4.2 requests/2.23.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.7.0

Release files / diffir-0.2.0-py3-none-any.whl

Download URL diffir-0.2.0-py3-none-any.whl
Size 34.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
833f62ff235125fa1dca8f5b457702db69a5bb5b7dbaa2828f8d70facafed01a
BLAKE2b-256 checksum
How to use checksums
ca8befc03586a5620fa26519c419ca54f48a619927080bc4438293cb7250307c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.4.2 requests/2.23.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.7.0

Security for diffir 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page