tensorflow / tensorflow/recommenders

[Question] Using bruteforce to retrieve recommendations in Sequential Model

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

Nobody has claimed this yet.

Dominant language
Python
Stars
2k
Forks
300
PR merge metrics
No merged PRs in 30d

Description

In this example: https://github.com/tensorflow/recommenders/blob/main/docs/examples/sequential_retrieval.ipynb
Could you give an example of how to use BruteForce to retrieve recommendations for sequence data?
when using spotlight by @maciejkula
i can get sequence recommendations from API by entering API body like this
{ "data": [ "End Game", "Age of Ultron", "Iron Man", "SpiderMan No Way Home", "Captain Marvel" ] }
using this function,

def recommend_next_movies(movies, metadata, model, n_movies=15):
   movie_ids = [get_movie_id(movie, metadata) for movie in movies]
   pred = model.predict(sequences=np.array(movie_ids))
   indices = np.argpartition(pred, -n_movies)[-n_movies:]
   best_movie_ids = indices[np.argsort(pred[indices])]
   return [get_metadata(movie_id + 1, metadata) for movie_id in best_movie_ids]
def predict(movies):
        d = recommend_next_movies(movies, metadata, model, n_movies=15)
        df = pd.DataFrame(list(chain.from_iterable(d)))
        return df

Is call function can handles this issue? thank you

any idea how to do this cc @juliobguedes

Contributor guide

Open the contributing guide

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 with docs/examples/sequential_retrieval.ipynb and review how the sequential model produces recommendations. Investigate how BruteForce accepts sequence data and compare it with the referenced Spotlight example; done means the notebook documents a working sequence-input retrieval example with expected recommendations.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, pandas, python, tensorflow
Domain
documentation, machine-learning
Issue type
Documentation
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.