tensorflow / tensorflow/recommenders

TypeError in FactorizedTopK with StringLookup when candidates dataset has dict structure

Open
#759 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

When using tfrs.metrics.FactorizedTopK with a candidate dataset, passing a dataset of dictionaries (e.g., {"movie_title": ...}) causes a TypeError.
The error indicates that StringLookup expects a string tensor but receives a dictionary.

Expected behavior
  1. The candidate dataset should be accepted even if it’s in dictionary form (common when using TFDS). The library should either:

  2. Automatically extract the correct feature (e.g., "movie_title"), or

  3. Provide clearer documentation/examples showing how to preprocess the dataset before passing to FactorizedTopK.

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 at tfrs.metrics.FactorizedTopK and reproduce the TypeError with a candidate dataset whose elements are dictionaries, noting the interaction with StringLookup. Determine whether dictionary candidates should be accepted or documented as requiring preprocessing, then add coverage or documentation that makes the supported behavior and completion criteria explicit.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, tensorflow
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.