unique_recipe_titles
: List of unique recipe titlesunique_user_ids
: List of unique user IDsembedding_dimension
: Dimensionality of the embedding space
- Input: Recipe titles
StringLookup
layer with no mask tokenEmbedding
layer with output dimensionembedding_dimension
- Embedding layer is adapted to unique recipe titles
- Input: User IDs
StringLookup
layer with no mask tokenEmbedding
layer with output dimensionembedding_dimension
- Embedding layer is adapted to unique user IDs
- Retrieval task using
tfrs.tasks.Retrieval
- Metrics:
tfrs.metrics.FactorizedTopK
- Candidates are generated by mapping a batch of recipes through the recipe model
-
Features:
user_id
: User ID tensorrecipe_title
: Recipe title tensor
-
Forward Pass:
- User embeddings obtained by passing
user_id
through the user model - Positive recipe embeddings obtained by passing
recipe_title
through the recipe model
- User embeddings obtained by passing
-
Loss Computation:
- Task computes the loss and metrics using user embeddings and positive recipe embeddings
- Input: Features dictionary with keys "user_id" and "recipe_title"
- Output: Tuple of user embeddings and recipe embeddings obtained by passing inputs through respective models