tensorflow / tensorflow/recommenders

Is this a typo in recommenders/docs/examples/basic_retrieval.ipynb?

Open
#299 3 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 class ModelensModel and NoBaseClassMovielensModel, the line of self.task in the init is:

self.task: tf.keras.layers.Layer = task

But in the quickstart.ipynb, the self.task in class Modelens is:

task: tfrs.tasks.Retrieval
self.task = task

I'm wondering if the task class belongs to the keras.layers.Layer class. Is this a typo?

Full code in quickstart:

class MovieLensModel(tfrs.Model):
  # We derive from a custom base class to help reduce boilerplate. Under the hood,
  # these are still plain Keras Models.

  def __init__(
      self,
      user_model: tf.keras.Model,
      movie_model: tf.keras.Model,
      task: tfrs.tasks.Retrieval):
    super().__init__()

    # Set up user and movie representations.
    self.user_model = user_model
    self.movie_model = movie_model

    # Set up a retrieval task.
    self.task = task

Full code in basic_retrieval:

class MovielensModel(tfrs.Model):

  def __init__(self, user_model, movie_model):
    super().__init__()
    self.movie_model: tf.keras.Model = movie_model
    self.user_model: tf.keras.Model = user_model
    self.task: tf.keras.layers.Layer = task
class NoBaseClassMovielensModel(tf.keras.Model):

  def __init__(self, user_model, movie_model):
    super().__init__()
    self.movie_model: tf.keras.Model = movie_model
    self.user_model: tf.keras.Model = user_model
    self.task: tf.keras.layers.Layer = task

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

Open recommenders/docs/examples/basic_retrieval.ipynb and compare the MovielensModel and NoBaseClassMovielensModel definitions with the quickstart.ipynb example shown in the issue. Check whether the task argument is defined and whether its annotation matches the retrieval task usage; done means the example is internally consistent and runs without this discrepancy.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, tensorflow
Domain
documentation, machine-learning
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.