Giter Site home page Giter Site logo

l2r's Introduction

ReadMe

This repository is used to share some L2R algorithms implemted by Python.

So far, this repository contains RankNet , LambdaRank and LambdaMART

RankNet

I utilize Pytorch to implement the network structure.

In order to use the interface, you should input following parameters:

  • n_feaure: int, features numble
  • h1_units: int, the unit numbers of hidden layer1
  • h2_units: int, the unit numbers of hidden layer2
  • epoch: int, iteration times
  • learning_rate: float, learning rate
  • plot: boolean, whether plot the loss.

LambdaRank

The usage is similar with RankNet.

LambdaMart

This is a Python version of LambdaMART.

I implement it based on the code of lezzago

‼️I have made some modification because I think there is a mistake on calculating $\lambda$ in lezzago's code.

Dataset

The dataset is the same as that of lezzago. I have preprocessed it and store in train.npy and test.npy.

You can directly used np.load() to import dataset.

The first column is label, the second column is qid, and the following columns are features (total 46 features).

l2r's People

Contributors

houchenyu 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

l2r's Issues

iDCG = 0?

iDCG是否可以是0?这种情形应该怎么计算NDCG和lambda呢?

lambdaRank: lambda calculate wrong

    delta = abs(single_dcgs[(i,j)] + single_dcgs[(j,i)] - single_dcgs[(i,i)] -single_dcgs[(j,j)])/IDCG

for this line,you mean the ith document in true_scores should be position i ? after checking the data, it seems wrong, maybe we should sort true socres and save the position of documents in true score which can be used here.

Questions about predicted_scores

Hi, sorry to bother you. I am an undergraduate student of sun yat-sen university and I am learning LambdaMART recently. Thank you for sharing the code. I have some doubts about the variable "predicted_scores"
Could you please tell me what it stands for? Does it mean a predicted label or a grade of document location? What does the sign mean?
I would appreciate it very much if you could response my issue. You can also contact me by email:[email protected]
Regards

lambdaMART

w[i] += rho * rho_complement * delta
w[i] -= rho * rho_complement * delta
你好,我想问下这里w表示什么意思,后面好像也没有用到这个值

RankNet code

Maybe there is a mistake in [split_pair(order_pairs)] Function, relevant_doc and irrelecant_doc do not move while qid increasing, it seems d1 and d2 always swing in the first part of the training_data. I think it might be add #code like below.

def split_pairs(order_pairs):
    """
    split the pairs into two list, named relevant_doc and irrelevant_doc.
    relevant_doc[i] is prior to irrelevant_doc[i]
    :param order_pairs: ordered pairs of all queries
    :return: relevant_doc and irrelevant_doc
    """
    relevant_doc = []
    irrelevant_doc = []
    # addindex = 0
    query_num = len(order_pairs)
    for i in range(query_num):
        pair_num = len(order_pairs[i])
        for j in range(pair_num):
            d1, d2 = order_pairs[i][j]
            # d1 = d1 + addindex
            # d2 = d2 + addindex
            relevant_doc.append(d1)
            irrelevant_doc.append(d2)
        # addindex = addindex + pair_num
    return relevant_doc, irrelevant_doc

Format of input data

Hello, you used a .npy format for the input data. What is the content and format of the input data in the raw text?

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.