rax

Rax is a Learning-to-Rank library written in JAX.

https://github.com/google/rax

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.3%) to scientific vocabulary

Keywords from Contributors

jax
Last synced: 7 months ago · JSON representation ·

Repository

Rax is a Learning-to-Rank library written in JAX.

Basic Info
  • Host: GitHub
  • Owner: google
  • License: apache-2.0
  • Language: Python
  • Default Branch: main
  • Homepage: https://rax.readthedocs.io
  • Size: 280 KB
Statistics
  • Stars: 331
  • Watchers: 4
  • Forks: 12
  • Open Issues: 2
  • Releases: 4
Created about 4 years ago · Last pushed 8 months ago
Metadata Files
Readme Contributing License Citation

README.md

🦖 Rax: Learning-to-Rank using JAX

Docs PyPI License

Rax is a Learning-to-Rank library written in JAX. Rax provides off-the-shelf implementations of ranking losses and metrics to be used with JAX. It provides the following functionality:

  • Ranking losses (rax.*_loss): rax.softmax_loss, rax.pairwise_logistic_loss, ...
  • Ranking metrics (rax.*_metric): rax.mrr_metric, rax.ndcg_metric, ...
  • Transformations (rax.*_t12n): rax.approx_t12n, rax.gumbel_t12n, ...

Ranking

A ranking problem is different from traditional classification/regression problems in that its objective is to optimize for the correctness of the relative order of a list of examples (e.g., documents) for a given context (e.g., a query). Rax provides support for ranking problems within the JAX ecosystem. It can be used in, but is not limited to, the following applications:

  • Search: ranking a list of documents with respect to a query.
  • Recommendation: ranking a list of items given a user as context.
  • Question Answering: finding the best answer from a list of candidates.
  • Dialogue System: finding the best response from a list of responses.

Synopsis

In a nutshell, given the scores and labels for a list of items, Rax can compute various ranking losses and metrics:

```python import jax.numpy as jnp import rax

scores = jnp.array([2.2, -1.3, 5.4]) # output of a model. labels = jnp.array([1.0, 0.0, 0.0]) # indicates doc 1 is relevant.

rax.ndcg_metric(scores, labels) # computes a ranking metric.

0.63092977

rax.pairwisehingeloss(scores, labels) # computes a ranking loss.

2.1

```

All of the Rax losses and metrics are purely functional and compose well with standard JAX transformations. Additionally, Rax provides ranking-specific transformations so you can build new ranking losses. An example is rax.approx_t12n, which can be used to transform any (non-differentiable) ranking metric into a differentiable loss. For example:

```python lossfn = rax.approxt12n(rax.ndcgmetric) lossfn(scores, labels) # differentiable approx ndcg loss.

-0.63282484

jax.grad(loss_fn)(scores, labels) # computes gradients w.r.t. scores.

[-0.01276882 0.00549765 0.00727116]

```

Installation

See https://github.com/jax-ml/jax#installation for instructions on installing JAX.

We suggest installing the latest stable version of Rax by running:

$ pip install rax

Examples

See the examples/ directory for complete examples on how to use Rax.

Citing Rax

If you use Rax, please consider citing our paper:

@inproceedings{jagerman2022rax, title = {Rax: Composable Learning-to-Rank using JAX}, author = {Rolf Jagerman and Xuanhui Wang and Honglei Zhuang and Zhen Qin and Michael Bendersky and Marc Najork}, year = {2022}, booktitle = {Proceedings of the 28th ACM SIGKDD International Conference on Knowledge Discovery \& Data Mining} }

Owner

  • Name: Google
  • Login: google
  • Kind: organization
  • Email: opensource@google.com
  • Location: United States of America

Google ❤️ Open Source

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use Rax, please consider citing our paper"
authors:
- family-names: "Jagerman"
  given-names: "Rolf"
  orcid: "https://orcid.org/0000-0002-5169-495X"
- family-names: "Wang"
  given-names: "Xuanhui"
- family-names: "Zhuang"
  given-names: "Honglei"
  orcid: "https://orcid.org/0000-0001-8134-1509"
- family-names: "Qin"
  given-names: "Zhen"
  orcid: "https://orcid.org/0000-0001-6739-134X"
- family-names: "Bendersky"
  given-names: "Michael"
- family-names: "Najork"
  given-names: "Marc"
  orcid: "https://orcid.org/0000-0003-1423-0854"
title: "Rax: Composable Learning-to-Rank using JAX"
url: "https://github.com/google/rax"
preferred-citation:
  type: conference-paper
  authors:
  - family-names: "Jagerman"
    given-names: "Rolf"
    orcid: "https://orcid.org/0000-0002-5169-495X"
  - family-names: "Wang"
    given-names: "Xuanhui"
  - family-names: "Zhuang"
    given-names: "Honglei"
    orcid: "https://orcid.org/0000-0001-8134-1509"
  - family-names: "Qin"
    given-names: "Zhen"
    orcid: "https://orcid.org/0000-0001-6739-134X"
  - family-names: "Bendersky"
    given-names: "Michael"
  - family-names: "Najork"
    given-names: "Marc"
    orcid: "https://orcid.org/0000-0003-1423-0854"
  collection-title: "Proceedings of the 28th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining"
  title: "Rax: Composable Learning-to-Rank using JAX"
  year: 2022

GitHub Events

Total
  • Release event: 1
  • Watch event: 14
  • Delete event: 9
  • Issue comment event: 2
  • Push event: 35
  • Pull request event: 18
  • Fork event: 1
  • Create event: 10
Last Year
  • Release event: 1
  • Watch event: 14
  • Delete event: 9
  • Issue comment event: 2
  • Push event: 35
  • Pull request event: 18
  • Fork event: 1
  • Create event: 10

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 124
  • Total Committers: 14
  • Avg Commits per committer: 8.857
  • Development Distribution Score (DDS): 0.282
Past Year
  • Commits: 8
  • Committers: 6
  • Avg Commits per committer: 1.333
  • Development Distribution Score (DDS): 0.75
Top Committers
Name Email Commits
Rolf Jagerman j****n@g****m 89
Xuanhui Wang x****i@g****m 10
Jake VanderPlas v****s@g****m 7
Honglei Zhuang h****z@g****m 3
Rax Developers r****v@g****m 3
Tianqi Liu t****u@g****m 2
Peter Hawkins p****s@g****m 2
Marcus Chiam m****m@g****m 2
hemanthhari2000 h****0@g****m 1
Rebecca Chen r****n@g****m 1
Neil Thomas t****l@g****m 1
Jake Harmon j****n@g****m 1
Daniel Suo d****o@g****m 1
Nikitas Rontsis n****r@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 7 months ago

All Time
  • Total issues: 3
  • Total pull requests: 152
  • Average time to close issues: 10 months
  • Average time to close pull requests: 5 days
  • Total issue authors: 3
  • Total pull request authors: 4
  • Average comments per issue: 0.33
  • Average comments per pull request: 0.08
  • Merged pull requests: 78
  • Bot issues: 1
  • Bot pull requests: 148
Past Year
  • Issues: 0
  • Pull requests: 24
  • Average time to close issues: N/A
  • Average time to close pull requests: 23 days
  • Issue authors: 0
  • Pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.25
  • Merged pull requests: 12
  • Bot issues: 0
  • Bot pull requests: 24
Top Authors
Issue Authors
  • allstar-app[bot] (1)
  • rjagerman (1)
  • travisbrady (1)
Pull Request Authors
  • copybara-service[bot] (148)
  • rjagerman (2)
  • Hemanthhari2000 (1)
  • thomas-a-neil (1)
Top Labels
Issue Labels
allstar (1) enhancement (1) wontfix (1)
Pull Request Labels
documentation (1)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 27,485 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 1
  • Total versions: 5
  • Total maintainers: 1
pypi.org: rax

Learning-to-Rank using JAX.

  • Versions: 5
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 27,485 Last month
Rankings
Downloads: 3.4%
Stargazers count: 3.7%
Forks count: 8.9%
Average: 9.5%
Dependent packages count: 10.0%
Dependent repos count: 21.7%
Maintainers (1)
Last synced: 7 months ago

Dependencies

requirements/requirements-docs.txt pypi
  • myst-parser >=0.18
  • sphinx >=4
  • sphinx-autodoc-typehints >=1
  • sphinx_rtd_theme >=1
  • sphinxcontrib-bibtex >=2
  • sphinxcontrib-katex >=0.8
requirements/requirements-examples.txt pypi
  • clu >=0.0.6
  • flax >=0.3
  • optax >=0.1
  • tensorflow >=2
  • tensorflow-datasets >=4
  • tfds-nightly >=4.0.0.dev
requirements/requirements-test.txt pypi
  • absl-py >=1
  • numpy >=1.5.0
  • pytype >=2022
requirements/requirements.txt pypi
  • jax >=0.2.0
  • jaxlib >=0.1.0
  • typing_extensions >=3.7.0
.github/workflows/publish.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
.github/workflows/unittests.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
examples/t5x/requirements.txt pypi
  • seqio-nightly *