Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use tensorflow ranking for prediction ? #48

Closed
vertika-19 opened this issue Apr 1, 2019 · 3 comments
Closed

How to use tensorflow ranking for prediction ? #48

vertika-19 opened this issue Apr 1, 2019 · 3 comments

Comments

@vertika-19
Copy link

As per my understanding from sample dataset, libsvm generator is assuming that relevance level will be present.

I am using sample
Can you suggest what changes to make so that I can use my trained model later for prediction of relevance levels/ranking based on features and document list for a query.

@eggie5
Copy link
Contributor

eggie5 commented Apr 2, 2019

This package uses the Tensorflow Estimators API, so accordingly your mode has a predict function. You can use this to rank documents in a query:

for x in ranker.predict(input_fn=lambda: input_fn_eval(test_path)):
    print(x)

@tomleung1996
Copy link

tomleung1996 commented Apr 8, 2019

This package uses the Tensorflow Estimators API, so accordingly your mode has a predict function. You can use this to rank documents in a query:

for x in ranker.predict(input_fn=lambda: input_fn_eval(test_path)):
    print(x)

I'm new to learning to rank, and I need some help on understanding the model's output.
For each iteration, it outputs a (100,) array for a single query, do you know how to interpret this result?

Does it indicate the relevance score of the first 100 "document" (order by document_id)? If so, how can I find the corresponding document in the test dataset? (it seems we don't specify an document_id in the dataset)

Thanks!

@sbruch
Copy link
Contributor

sbruch commented Apr 17, 2019

Vertika - Apologies for the delayed response. Alex is correct; you will need to invoke the learned model in predict mode to obtain per-document score. You may then sort documents by their score to obtain a ranked list.

Tom - generally speaking, the per-query output is a Tensor of relevance scores where the i^{th} score corresponds to the i^{th} document in the input Tensor. Note that during training, the dimension of the input Tensor that corresponds to the number of documents per query is fixed to "list-size" (in your case, it appears to be 100). If there are fewer than list-size documents available for your a query, its Tensor is padded.

Please let us know if you have additional questions.

@sbruch sbruch closed this as completed Apr 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants