Learning to Rank with PyTorch
Project description
PyTorch Learning to Rank (LTR)
This is a library for Learning to Rank (LTR) with PyTorch. The goal of this library is to support the infrastructure necessary for performing LTR experiments in PyTorch.
Installation
In your virtualenv simply run:
pip install pytorchltr
Note that this library requires Python 3.5 or higher.
Documentation
Documentation is available here.
Example
See examples/01-basic-usage.py
for a more complete example including evaluation
import torch
from pytorchltr.datasets import Example3
from pytorchltr.loss import PairwiseHingeLoss
# Load dataset
train = Example3(split="train")
collate_fn = train.collate_fn()
# Setup model, optimizer and loss
model = torch.nn.Linear(train[0].features.shape[1], 1)
optimizer = torch.optim.SGD(model.parameters(), lr=0.1)
loss = PairwiseHingeLoss()
# Train for 3 epochs
for epoch in range(3):
loader = torch.utils.data.DataLoader(train, batch_size=2, collate_fn=collate_fn)
for batch in loader:
xs, ys, n = batch.features, batch.relevance, batch.n
l = loss(model(xs), ys, n).mean()
optimizer.zero_grad()
l.backward()
optimizer.step()
Dataset Disclaimer
This library provides utilities to automatically download and prepare several public LTR datasets. We cannot vouch for the quality, correctness or usefulness of these datasets. We do not host or distribute these datasets and it is ultimately your responsibility to determine whether you have permission to use each dataset under its respective license.
Citing
If you find this software useful for your research, we kindly ask you to cite the following publication:
@inproceedings{jagerman2020accelerated,
author = {Jagerman, Rolf and de Rijke, Maarten},
title = {Accelerated Convergence for Counterfactual Learning to Rank},
year = {2020},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
booktitle = {Proceedings of the 43rd International ACM SIGIR Conference on Research and Development in Information Retrieval},
doi = {10.1145/3397271.3401069},
series = {SIGIR’20}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file pytorchltr-0.2.1.tar.gz
.
File metadata
- Download URL: pytorchltr-0.2.1.tar.gz
- Upload date:
- Size: 144.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.6.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 58d60f1da45ab73d29f9594922b9ee601a7f65b42759585baba799f83b0fc945 |
|
MD5 | d832aeb11947247552abe6503d5afc35 |
|
BLAKE2b-256 | c0aee9d44249dd7a7e4b46d3ec6ba563078d2d915635c451c5b60a8b22468715 |
File details
Details for the file pytorchltr-0.2.1-cp38-cp38-win_amd64.whl
.
File metadata
- Download URL: pytorchltr-0.2.1-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 106.5 kB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5e95b7476a1716e489dd8d1402722713dfb50bb6574dc4d66a737983577e55f |
|
MD5 | 68a55c6f2a6de0042a6946b038e49614 |
|
BLAKE2b-256 | 150ec8c3ff4e7a0db0c2074f0c95fa5a50819fa069a1a8352be67fa07fd111cd |
File details
Details for the file pytorchltr-0.2.1-cp38-cp38-manylinux1_x86_64.whl
.
File metadata
- Download URL: pytorchltr-0.2.1-cp38-cp38-manylinux1_x86_64.whl
- Upload date:
- Size: 345.4 kB
- Tags: CPython 3.8
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eadf7ca46392870cdb21588adb65c7a7a62f7efb79fb88bab669694602365bac |
|
MD5 | 11e7f912b6658fb57ca450c73638714f |
|
BLAKE2b-256 | 7f749e4e19ceb14a1b04172149a4a956ff4ea9d25f0bb65518d3ff5766221daf |
File details
Details for the file pytorchltr-0.2.1-cp38-cp38-macosx_10_14_x86_64.whl
.
File metadata
- Download URL: pytorchltr-0.2.1-cp38-cp38-macosx_10_14_x86_64.whl
- Upload date:
- Size: 106.8 kB
- Tags: CPython 3.8, macOS 10.14+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f82dafe4661ec430f0a2b0b518a9de2ab66501248bdee5b544132798bdc249e4 |
|
MD5 | a670575bcd8dfa556caa06ec91db5077 |
|
BLAKE2b-256 | 6cd8306ead8a4b2854e1f6fbc28ac83cae705f8baef0dced9fc90a47a8d928e0 |
File details
Details for the file pytorchltr-0.2.1-cp37-cp37m-win_amd64.whl
.
File metadata
- Download URL: pytorchltr-0.2.1-cp37-cp37m-win_amd64.whl
- Upload date:
- Size: 105.4 kB
- Tags: CPython 3.7m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 39e9c9dee4f70b41c7062d688e654670ca542906667e9a6a2071ced00751d1fc |
|
MD5 | 7be34618e0b472c537e776f63b606516 |
|
BLAKE2b-256 | ffa76894ce5bddb63ecb37c8146ddced376d60994ddde4831755486b0b592301 |
File details
Details for the file pytorchltr-0.2.1-cp37-cp37m-manylinux1_x86_64.whl
.
File metadata
- Download URL: pytorchltr-0.2.1-cp37-cp37m-manylinux1_x86_64.whl
- Upload date:
- Size: 335.2 kB
- Tags: CPython 3.7m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cdfc2730c018d5e8146d5ba07882de804d8a1ca186382aa845ef03ef3aff2f6c |
|
MD5 | 0c01ed3ee066b8f3204e2df03c2e623a |
|
BLAKE2b-256 | ffbc0eec0fd2113410d6ea180e10e661cea066b3e50b74b44dd82983bd9442b0 |
File details
Details for the file pytorchltr-0.2.1-cp37-cp37m-macosx_10_14_x86_64.whl
.
File metadata
- Download URL: pytorchltr-0.2.1-cp37-cp37m-macosx_10_14_x86_64.whl
- Upload date:
- Size: 107.4 kB
- Tags: CPython 3.7m, macOS 10.14+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2feee5e649f0b8625e4f3239bf0447fcba2e874ed921c0db9b969931be1eb131 |
|
MD5 | 6ac22c9c5ca5060533edfec8bae527a5 |
|
BLAKE2b-256 | e7143c506f3c91d40a99ac0c7a2feccfa129caf24b49a9eec4d66eaf15ee2df8 |
File details
Details for the file pytorchltr-0.2.1-cp36-cp36m-win_amd64.whl
.
File metadata
- Download URL: pytorchltr-0.2.1-cp36-cp36m-win_amd64.whl
- Upload date:
- Size: 105.4 kB
- Tags: CPython 3.6m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a109becf65693ddc4694cd782e02fa637a37fe1fbeed09ff1a42e9ba130fa241 |
|
MD5 | e248b5b8e73613f7a49f51ff2953abf2 |
|
BLAKE2b-256 | 5eb2b9b412cc9fa23db20b0a3be64f5cd50881891125dd358cb21c4bdbe998f4 |
File details
Details for the file pytorchltr-0.2.1-cp36-cp36m-manylinux1_x86_64.whl
.
File metadata
- Download URL: pytorchltr-0.2.1-cp36-cp36m-manylinux1_x86_64.whl
- Upload date:
- Size: 336.3 kB
- Tags: CPython 3.6m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.6.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | afedbafdd216826037b35a7407c88634ea6f1d7dc57c3437d211d581ece4ae22 |
|
MD5 | 53b5bbb55aad3df365dd3ee2a29bc97e |
|
BLAKE2b-256 | 958b693a42733e0a629b43e3c846fb9b3901e214f606b7cb3174123083d6b4e0 |
File details
Details for the file pytorchltr-0.2.1-cp36-cp36m-macosx_10_14_x86_64.whl
.
File metadata
- Download URL: pytorchltr-0.2.1-cp36-cp36m-macosx_10_14_x86_64.whl
- Upload date:
- Size: 107.2 kB
- Tags: CPython 3.6m, macOS 10.14+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.6.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88f87596308063e569313880598fb167a6cdf4b034dd6fd3a0b57fd397ce798a |
|
MD5 | e6c591c115e9dd673a52e612c6526485 |
|
BLAKE2b-256 | 42609505f9a16c3089489400f0dbede9b37ebf2cadbd38fbbcd85f665786369d |
File details
Details for the file pytorchltr-0.2.1-cp35-cp35m-win_amd64.whl
.
File metadata
- Download URL: pytorchltr-0.2.1-cp35-cp35m-win_amd64.whl
- Upload date:
- Size: 104.8 kB
- Tags: CPython 3.5m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.5.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 17639b1632b7518f92e41a706b86590c8a3b8c29c88e7d559870b86748ac4923 |
|
MD5 | 474541b3b70a69edd2f46ff819f3be90 |
|
BLAKE2b-256 | 2bbf2700b4e4408c79718fcfb4432fdd542988e5d9855e65fd9c57b57208cf6c |
File details
Details for the file pytorchltr-0.2.1-cp35-cp35m-manylinux1_x86_64.whl
.
File metadata
- Download URL: pytorchltr-0.2.1-cp35-cp35m-manylinux1_x86_64.whl
- Upload date:
- Size: 332.5 kB
- Tags: CPython 3.5m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.5.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 05dfce191056ed72b86198101d6b61b4f3af76485a49e13970696f139a8dc265 |
|
MD5 | 8409e295d19005860c3fb8cc7b0f6e06 |
|
BLAKE2b-256 | cd8392537027394b51ddfc4172e7d03acb00070f7c20fdb77627e5bb99872667 |
File details
Details for the file pytorchltr-0.2.1-cp35-cp35m-macosx_10_15_x86_64.whl
.
File metadata
- Download URL: pytorchltr-0.2.1-cp35-cp35m-macosx_10_15_x86_64.whl
- Upload date:
- Size: 106.3 kB
- Tags: CPython 3.5m, macOS 10.15+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.5.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e52f173f35434ed442b6ba5134a13ce3ee1fa5ff2867175aae506f1fa37bf830 |
|
MD5 | 10663da5f09770355cd56f9e411a5100 |
|
BLAKE2b-256 | ce59da36800daad9ef7014f015b2f833a473ee5c8b2d5ca7d8593d5867f5031e |