Skip to content
This repository has been archived by the owner on Jun 29, 2020. It is now read-only.


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


Build Status Coverage Status

⚠️ This library has been deprecated and archived in favor of

Shoelace is a neural Learning to Rank library using Chainer. The goal is to make it easy to do offline learning to rank experiments on annotated learning to rank data.


Comprehensive documentation is available online here


numpy >= 1.12.0
chainer >= 2.0.0


pip install shoelace


Dataset loading facilities

We currently provide ability to load learning to rank datasets (SVMRank format) into chainer.

from shoelace.dataset import LtrDataset

with open('./dataset.txt', 'r') as file:
    dataset = LtrDataset.load_txt(file)

Additionally, we provide minibatch iterators for Learning to Rank datasets. These generate variable-sized minibatches, where each minibatch represents one query and all associated query-document instances. You can additionally specify whether the iterator should repeat infinitely and/or shuffle the data on every epoch.

from shoelace.iterator import LtrIterator

iterator = LtrIterator(dataset, repeat=True, shuffle=True)

Loss functions

Currently we provide implementations for the following loss functions

  • Top-1 ListNet: shoelace.loss.listwise.listnet
  • ListMLE: shoelace.loss.listwise.listmle
  • ListPL: shoelace.loss.listwise.listpl


Here is an example script that will train up a single-layer linear neural network with a ListNet loss function:

from shoelace.dataset import LtrDataset
from shoelace.iterator import LtrIterator
from shoelace.loss.listwise import listnet
from chainer import training, optimizers, links, Chain
from import extensions

# Load data and set up iterator
with open('./path/to/ranksvm.txt', 'r') as f:
    training_set = LtrDataset.load_txt(f)
training_iterator = LtrIterator(training_set, repeat=True, shuffle=True)

# Create neural network with chainer and apply loss function
predictor = links.Linear(None, 1)
class Ranker(Chain):
    def __call__(self, x, t):
        return listnet(self.predictor(x), t)
loss = Ranker(predictor=predictor)

# Build optimizer, updater and trainer
optimizer = optimizers.Adam()
updater = training.StandardUpdater(training_iterator, optimizer)
trainer = training.Trainer(updater, (40, 'epoch'))

# Train neural network


If you find this project useful in your research, please cite the following paper in your publication(s):

Rolf Jagerman, Julia Kiseleva and Maarten de Rijke. "Modeling Label Ambiguity for Neural List-Wise Learning to Rank" (2017)

  title={Modeling Label Ambiguity for Neural List-Wise Learning to Rank},
  author={Jagerman, Rolf and Kiseleva, Julia and de Rijke, Maarten},
  journal={arXiv preprint arXiv:1707.07493},