Giter Site home page Giter Site logo

learning2rank's Introduction

Learning to Rank

An easy implementation of algorithms of learning to rank. Pairwise (RankNet) and ListWise (ListNet) approach. There implemented also a simple regression of the score with neural network. [Contribution Welcome!]

Requirements

RankNet

Pairwise comparison of rank

The original paper was written by Chris Burges et al., "Learning to Rank using Gradient Descent." (available at http://research.microsoft.com/en-us/um/people/cburges/papers/ICML_ranking.pdf)

Usage

Import and initialize

from learning2rank.rank import RankNet
Model = RankNet.RankNet()

Fitting (automatically do training and validation)

Model.fit(X, y)

Here, X is numpy array with the shape of (num_samples, num_features) and y is numpy array with the shape of (num_samples, ). y is the score which you would like to rank based on (e.g., Sales of the products, page view, etc).

Possible options and defaults:

batchsize=100, n_iter=5000, n_units1=512, n_units2=128, tv_ratio=0.95, optimizerAlgorithm="Adam", savefigName="result.pdf", savemodelName="RankNet.model"

n_units1 and n_units2=128 are the number of nodes in hidden layer 1 and 2 in the neural net.

tv_ratio is the ratio of the data amounts between training and validation.

Predict

Model.predict(X)

ListNet

Listwise comparison of rank

The original paper was written by Zhe Cao, Tao Qin, Tie-Yan Liu, Ming-Feng Tsai, Hang Li "Learning to Rank: From Pairwise Approach to Listwise Approach." (Available at http://research.microsoft.com/en-us/people/tyliu/listnet.pdf)

NOTICE: The top-k probability is not written. This is listwise approach with neuralnets, comparing two arrays by Jensen-Shannon divergence.

Usage

Import and initialize

from learning2rank.rank import ListNet
Model = ListNet.ListNet()

Fitting (automatically do training and validation)

Model.fit(X, y)

Same as ranknet, X is numpy array with the shape of (num_samples, num_features) and y is numpy array with the shape of (num_samples, ). y is the score which you would like to rank based on (e.g., Sales of the products, page view, etc).

Possible options and defaults:

batchsize=100, n_epoch=200, n_units1=512, n_units2=128, tv_ratio=0.95, optimizerAlgorithm="Adam", savefigName="result.pdf", savemodelName="ListNet.model"

Predict

Model.predict(X)

Regression

Regression the scores with neural network

Usage

Import and initialize

from learning2rank.regression import NN
Model = NN.NN()

Fitting (automatically do training and validation)

Model.fit(X, y)

Possible options and defaults:

batchsize=100, n_iter=5000, n_units1=512, n_units2=128, tv_ratio=0.95, optimizerAlgorithm="Adam", savefigName="result.pdf", savemodelName="RankNet.model"

n_units1 and n_units2=128 are the number of nodes in hidden layer 1 and 2 in the neural net.

tv_ratio is the ratio of the data amounts between training and validation.

Predict

Model.predict(X)

Author

If you have any troubles or questions, please contact shiba24.

March, 2016

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.