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

Why are retrieval's outputs not used in ranking task? #1

Open
jack-pan-ai opened this issue May 10, 2021 · 1 comment
Open

Why are retrieval's outputs not used in ranking task? #1

jack-pan-ai opened this issue May 10, 2021 · 1 comment

Comments

@jack-pan-ai
Copy link

Hello, there is seemingly no use of retrieval's output when doing the ranking task. So, I'm wondering in your code, if I would like to use retrieval output when doing the ranking task, what should l do? Thanks a lot !!

@keivanipchihagh
Copy link
Contributor

Here are the steps on how to use the output of the Retrieval for Ranking:

  1. First give a user_id to the Retrieval model:
user_id = '41'
afinity_scores, movie_ids = scann_layer(
    tf.constant([user_id])
)

Which would output something like:

>> movie_ids[0, :5]
[b'196' b'969' b'211' b'215' b'174']
  1. Then, pass the models_ids to the Ranking model:
for movie_id in movie_ids[0, :5]:
    _ = ranking_model({
        "user_id": np.array(user_id),
        "movie_id": np.array([movie_id])
    })
    print(_[0][0].numpy())

Which would output something like:

3.4644787,
3.3514086,
...

If you make this into a pipeline, you will then pass in a user_id and get movie_ids with their corresponding ranking scores.

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

2 participants