Coder Social home page Coder Social logo

rankereval's Introduction

RankerEval

Latest PyPI version

Latest GitHub actions build status

A fast numpy/numba-based implementation of ranking metrics for information retrieval and recommendation. Coded with efficiency in mind and support for edge cases.

Find the full documentation here.

Features

  • Wide array of evaluation metrics for information retrieval and top-N recommender systems:
    • Binary labels: Recall, Precision, MAP, HitRate, MRR, MeanRanks, F1
    • Numeric and binary labels: DCG, nDCG
  • Minimal dependencies: Numpy and Numba (required), SciPy (optional)
  • Flexible input formats: Supports arrays, lists and sparse matrices
  • Built-in support for confidence intervals via bootstrapping

Usage

from rankereval import BinaryLabels, Rankings, Recall

y_true = BinaryLabels.from_positive_indices([[0,2], [0,1,2]])
y_pred = Rankings.from_ranked_indices([[2,1], [1]])

recall_at_3 = Recall(3).mean(y_true, y_pred)
print(recall_at_3)

To get confidence intervals (95% by default), specify conf_interval=True:

recall_at_3 = Recall(3).mean(y_true, y_pred, conf_interval=True)
print(recall_at_3["conf_interval"])

Input formats

RankerEval allows for a variety of input formats, e.g.,

# specify all labels as lists
y_true = BinaryLabels.from_matrix([[1,0,1], [1,1,1]])

# specify labels as numpy array
y_true = BinaryLabels.from_matrix(np.asarray([[1,0,1], [1,1,1]]))

# or use a sparse matrix
import scipy.sparse as sp
y_true = BinaryLabels.from_matrix(sp.coo_matrix([[1,0,1], [1,1,1]]))

Installation

To install (requires Numpy 1.18 or newer):

pip install rankereval

Licence

This project is licensed under MIT.

Authors

RankerEval was written by Tobias Schnabel.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] <mailto:[email protected]> with any additional questions or comments.

rankereval's People

Contributors

microsoft-github-operations[bot] avatar microsoftopensource avatar t-schn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

rankereval's Issues

From_sparse not supported

Hi,

I am trying to use your package, in particular the from_sparse function for my input data, however it says that rankEval does not support from_sparse. I have also attached a picture of the error.

Does the package no longer support this input type?

Thanks,

Franzi
binary

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.