Skip to content

TypeError in FactorizedTopK with StringLookup when candidates dataset has dict structure #759

@ArafathJ

Description

@ArafathJ

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions