Skip to main content

Context-sensitive ranking

Project description

Build Status Coverage Binder

CS-Rank

CS-Rank is a Python package for context-sensitive ranking and choice algorithms.

We implement the following new object ranking/choice architectures:

  • FATE (First aggregate then evaluate)

  • FETA (First evaluate then aggregate)

In addition, we also implement these algorithms for choice functions:

  • RankNetChoiceFunction

  • GeneralizedLinearModel

  • PairwiseSVMChoiceFunction

These are the state-of-the-art approaches implemented for the discrete choice setting:

  • GeneralizedNestedLogitModel

  • MixedLogitModel

  • NestedLogitModel

  • PairedCombinatorialLogit

  • RankNetDiscreteChoiceFunction

  • PairwiseSVMDiscreteChoiceFunction

Check out our interactive notebooks to quickly find out what our package can do.

Getting started

As a simple “Hello World!”-example we will try to learn the Pareto problem:

import csrank as cs
from csrank import ChoiceDatasetGenerator
gen = ChoiceDatasetGenerator(dataset_type='pareto',
                                n_objects=30,
                                n_features=2)
X_train, Y_train, X_test, Y_test = gen.get_single_train_test_split()

All our learning algorithms are implemented using the scikit-learn estimator API. Fitting our FATENet architecture is as simple as calling the fit method:

fate = cs.FATEChoiceFunction()
fate.fit(X_train, Y_train)

Predictions can then be obtained using:

fate.predict(X_test)

Installation

The latest release version of CS-Rank can be installed from Github as follows:

pip install git+https://github.com/kiudee/cs-ranking.git

Another option is to clone the repository and install CS-Rank using:

python setup.py install

Dependencies

CS-Rank depends on Tensorflow, Keras, NumPy, SciPy, matplotlib, scikit-learn, scikit-optimize, joblib and tqdm. For data processing and generation you will also need PyGMO, H5Py and pandas.

Citing CS-Rank

You can cite our arXiv papers:

@article{csrank2019,
  author    = {Karlson Pfannschmidt and
               Pritha Gupta and
               Eyke H{\"{u}}llermeier},
  title     = {Learning Choice Functions: Concepts and Architectures },
  journal   = {CoRR},
  volume    = {abs/1901.10860},
  year      = {2019}
}

@article{csrank2018,
  author    = {Karlson Pfannschmidt and
               Pritha Gupta and
               Eyke H{\"{u}}llermeier},
  title     = {Deep architectures for learning context-dependent ranking functions},
  journal   = {CoRR},
  volume    = {abs/1803.05796},
  year      = {2018}
}

License

Apache License, Version 2.0

History

Unreleased

No changes yet.

1.2.1 (2020-06-08)

  • Make all our optional dependencies mandatory to work around a bug in our optional imports code. Without this, an exception is raised on import. A proper fix will follow.

1.2.0 (2020-06-05)

  • Change public interface of the learners to be more in line with the scikit-learn interface (ongoing). As part of these changes, it is no longer required to explicitly pass the data dimensionality to the learners on initialization.

  • Rewrite and document normalized discounted cumulative gain (ndcg) metric to fix numerical issues. See #32 for details.

  • Fix passing fit keyword arguments on to the core network in FATEChoiceFunction.

  • Fix arguments for AllPositive baseline.

  • Raise ValueError rather than silently using a default value for unknown passed arguments.

  • Internal efforts to increase code quality and make use of linting (black, flake8, doc8).

  • Remove old experimental code.

1.1.0 (2020-03-19)

  • Add the expected reciprocal rank (ERR) metric.

  • Fix bug in callbacks causing the wrong learning rate schedule to be applied.

  • Make csrank easier to install by making some dependencies optional.

  • Add guidelines for how to contribute to the project.

1.0.2 (2020-02-12)

  • Fix deployment to GH-pages

1.0.1 (2020-02-03)

  • Add HISTORY.rst file to track changes over time

  • Set up travis-ci for deployment to PyPi

1.0.0 (2018-03-05)

  • Initial release

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

csrank-1.2.1.tar.gz (123.5 kB view details)

Uploaded Source

Built Distribution

csrank-1.2.1-py2.py3-none-any.whl (214.1 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file csrank-1.2.1.tar.gz.

File metadata

  • Download URL: csrank-1.2.1.tar.gz
  • Upload date:
  • Size: 123.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1.post20200604 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.6

File hashes

Hashes for csrank-1.2.1.tar.gz
Algorithm Hash digest
SHA256 78c0ac70428aaa056754048737ca551c6b416e88abb7276651db6da0fc9df936
MD5 2b3ad9fea83bce647afffa15e8487ca4
BLAKE2b-256 bd0df7dc359c749af0d26c35beaeed6bc4834e99352b78d097d458bb67b21e7a

See more details on using hashes here.

File details

Details for the file csrank-1.2.1-py2.py3-none-any.whl.

File metadata

  • Download URL: csrank-1.2.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 214.1 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1.post20200604 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.6

File hashes

Hashes for csrank-1.2.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 279a552843336b26e6b9ce68a9d25d3f0f11c3f0aac62a06fa9c70eb93ecaca8
MD5 3a4da4ae97d5f9b2706e81a8960e008d
BLAKE2b-256 b47b2c15f584b3dcd551eea9d25eebeabf1856ef4f19a7090de858039fbf5334

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page