tfrs.examples.movielens.sample_listwise
Stay organized with collections
Save and categorize content based on your preferences.
Function for converting the MovieLens 100K dataset to a listwise dataset.
tfrs.examples.movielens.sample_listwise(
rating_dataset: tf.data.Dataset,
num_list_per_user: int = 10,
num_examples_per_list: int = 10,
seed: Optional[int] = None
) -> tf.data.Dataset
Used in the notebooks
Args |
rating_dataset
|
The MovieLens ratings dataset loaded from TFDS with features
"movie_title", "user_id", and "user_rating".
|
num_list_per_user
|
An integer representing the number of lists that should be sampled for
each user in the training dataset.
|
num_examples_per_list
|
An integer representing the number of movies to be sampled for each list
from the list of movies rated by the user.
|
seed
|
An integer for creating np.random.RandomState .
|
Returns |
A tf.data.Dataset containing list examples.
Each example contains three keys: "user_id", "movie_title", and
"user_rating". "user_id" maps to a string tensor that represents the user
id for the example. "movie_title" maps to a tensor of shape
[sum(num_example_per_list)] with dtype tf.string. It represents the list
of candidate movie ids. "user_rating" maps to a tensor of shape
[sum(num_example_per_list)] with dtype tf.float32. It represents the
rating of each movie in the candidate list.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-04-26 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-04-26 UTC."],[],[]]