lyst / lyst/lightfm

Computing ranks from predictions

Open
#602 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
5.1k
Forks
724
PR merge metrics
No merged PRs in 30d

Description

Hello, I'm trying to compute the ranks matrix from the model predictions. using the function below

` mask = ~test_interactions.A.astype(bool)
predictions = model.predict(user_ids, item_ids)
ranks_array = predictions.copy()
argsorts = np.argsort(ranks_array, axis=1)
rankings = range(argsorts.shape[1])[::-1]

for i in range(ranks_array.shape[0]):
ranks_array[i, argsorts[i]] = rankings

ranks_array[mask] = 0

return sparse.csr_matrix(ranks_array)`

When I compare the obtained ranks with the obtained ones from model.predict_rank() I dont get the same ranks.

What am I doing wrong? Can you help please Thank you

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the model.predict() and model.predict_rank() entry points, then compare their ranking behavior with the supplied NumPy sorting code. Reproduce the mismatch using the shown inputs and determine which rank semantics differ; done means the discrepancy is explained and the expected behavior is documented or covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.